https://github.com/aportela/scraper-lyrics
Custom php lyrics scraper
https://github.com/aportela/scraper-lyrics
composer-package duckduckgo genius lyrics lyricsmania musicmatch php php8 scraper
Last synced: 3 months ago
JSON representation
Custom php lyrics scraper
- Host: GitHub
- URL: https://github.com/aportela/scraper-lyrics
- Owner: aportela
- License: agpl-3.0
- Created: 2023-09-29T09:23:48.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-11-29T23:29:52.000Z (7 months ago)
- Last Synced: 2025-12-02T04:28:17.545Z (7 months ago)
- Topics: composer-package, duckduckgo, genius, lyrics, lyricsmania, musicmatch, php, php8, scraper
- Language: PHP
- Homepage:
- Size: 154 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# scraper-lyrics
Custom php lyrics scraper
## Requirements
- mininum php version 8.4
## Install (composer) dependencies:
```Shell
composer require aportela/scraper-lyrics
```
## WARNING:
Please, to prevent source providers from making changes or banning the operation of this scraper, use it reasonably, caching the results in your own storage or database to avoid repeating the same calls. Also, try not to make several calls per second that could be interpreted as a DDOS attack.
## Code example:
```php
scrap(
"Bohemian Rhapsody",
"Queen"
)) {
echo sprintf(
"
Title: %s
Artist: %s
Source: %s
%s
",
$lyrics->getTitle(),
$lyrics->getArtist(),
$lyrics->getSource(),
$lyrics->getLyrics()
);
}
/**
Search/Scrap on custom scrap providers
You can use this method if at some point in the future a provider stops working and you want to ignore scraping with him (which will give an error) in case you previously used the global (scrap) method
*/
if ($lyrics->scrap(
"Bohemian Rhapsody",
"Queen",
[
\aportela\ScraperLyrics\SourceProvider::SEARCH_ENGINE_DUCKDUCKGO,
\aportela\ScraperLyrics\SourceProvider::MUSIXMATCH
]
)) {
echo sprintf(
"
Title: %s
Artist: %s
Source: %s
%s
",
$lyrics->getTitle(),
$lyrics->getArtist(),
$lyrics->getSource(),
$lyrics->getLyrics()
);
}
/**
Search/Scrap on custom source provider
Same as the previous one but for a single source provider
*/
if ($lyrics->scrapFromSourceProvider(
"Bohemian Rhapsody",
"Queen",
\aportela\ScraperLyrics\SourceProvider::SEARCH_ENGINE_DUCKDUCKGO
)) {
echo sprintf(
"
Title: %s
Artist: %s
Source: %s
%s
",
$lyrics->getTitle(),
$lyrics->getArtist(),
$lyrics->getSource(),
$lyrics->getLyrics()
);
}
```
