Paroles.net Scraper
A Python package to fetch song lyrics from paroles.net.
Features
- Fetches song lyrics from paroles.net
- Cleans up advertisement content from lyrics
- Handles URL construction for different artists and songs
- Command-line interface for easy usage
- Comprehensive test suite
- Installable Python package
Installation
-
Clone or download this repository
-
Install the package in development mode:
pip install -e .Or if you're using uv:
uv sync
Usage
Command Line Interface
After installation, you can use the command line interface with two formats:
- Single argument with dash separator:
paroles-scraper "Artist Name - Song Title"
- Two separate arguments:
paroles-scraper "Artist Name" "Song Title"
Examples
paroles-scraper "SCORPIONS - SEND ME AN ANGEL"
paroles-scraper "Ed Sheeran" "Shape of You"
paroles-scraper "Imagine Dragons" "Believer"
As a Python Package
You can also use the package directly in your Python code:
from paroles_net_scraper import get_song_lyrics
lyrics = get_song_lyrics("Ed Sheeran", "Shape of You")
print(lyrics)
Testing
The project includes a comprehensive test suite using pytest. To run the tests:
pytest tests/ -v
Or if you're using uv:
uv run pytest tests/ -v
Code Quality
This project uses Ruff for linting and formatting, and pre-commit hooks to ensure code quality.
Linting and Formatting
- Ruff is used for both linting and formatting
- pre-commit hooks are installed to automatically check and format code before committing
To manually run linting:
ruff check .
To automatically fix linting issues:
ruff check . --fix
To format code:
ruff format .
Pre-commit Hooks
Pre-commit hooks are automatically run when you commit changes. To manually run all pre-commit hooks:
pre-commit run --all-files
Development Dependencies
To install development dependencies including Ruff and pre-commit:
uv pip install -e .[dev]
Or using Make:
make install-dev
CI/CD
This project includes a GitLab CI configuration (.gitlab-ci.yml) that:
- Runs tests on multiple Python versions
- Builds the package using uv
- Can deploy to PyPI (when configured with credentials)
To use the GitLab CI pipeline:
- Push your code to a GitLab repository
- Ensure your GitLab runner is configured
- Set up PyPI credentials as CI/CD variables if you want to deploy
Building and Uploading to Gitea Package Registry
This project includes scripts to build and upload packages to Gitea's PyPI package registry.
Prerequisites
- Create a personal access token in Gitea with package registry permissions
- Configure
~/.pypircwith your Gitea credentials:
[distutils]
index-servers = gitea
[gitea]
repository = https://gitea.parano.ch/api/packages/herel/pypi
username = herel
password = YOUR_GITEA_PERSONAL_ACCESS_TOKEN
Using the Build and Upload Scripts
Option 1: Using the shell script
./scripts/build_and_upload.sh
Option 2: Using the Python script
uv run scripts/build_and_upload.py
Option 3: Using Make
make upload
Option 4: Using the installed command
After installing the package in development mode:
uv pip install -e .
build-and-upload
Manual Build and Upload
If you prefer to build and upload manually:
-
Build the package:
uv build -
Upload to Gitea:
twine upload --repository gitea dist/*
Installing from Gitea PyPI
To install a package from Gitea's registry:
pip install --index-url https://YOUR_GITEA_TOKEN@gitea.parano.ch/api/packages/herel/pypi/simple --no-deps paroles-net-scraper
Note: Replace YOUR_GITEA_TOKEN with your actual personal access token.
How it works
The package constructs a URL based on the artist name and song title, then scrapes the paroles.net website to extract the lyrics. It uses BeautifulSoup to parse the HTML and extract only the relevant text content while filtering out advertisements and other unwanted content.
Disclaimer
This package is for educational purposes only. Please respect the terms of service of paroles.net and use this package responsibly. Consider the legal and ethical implications of web scraping before using this tool.
Dependencies
- Python 3.7+
- requests
- beautifulsoup4
- pytest (for running tests)
- uv (for dependency management and packaging)