UG-Scraper-RS
This crate is able to fetch search results and tab data from Ultimate Guitar using web-scraping. It aims to be easy to use and as reliable as possible.
IMPORTANT NOTICE
This crate fetches data in a way not intended by the host (Ultimate Guitar). Thus, the used RegEx patterns may obsolete if the host makes major changes on their website.
When this happens, I'll publish a patch as soon as possible, but there is no warranty of the promptness of publication.
Features
The crate provides functions for getting search results for a certain query and for downloading specific kinds of tabs from Ultimate Guitar.
All types implement the serde
traits Serialize
and Deserialize
.
Downloading tabs
Supported tab formats are: Chords, Tabs, Bass Tabs, Ukulele Chords, Drums
When a tab is downloaded, a Song
is returned, containing basic metadata like the artist or song name, optional metadata like the capo position or tuning and a Vec
of the tab's lines with their associated type.
There is an option to automatically detect and replace the German names of chords with their English equivalents.
Searching for tabs
There is module for searching for a certain query on UG is available.
It returns a Vec
of SearchResult
objects containing basic metadata about the tab and the associated URL which may be downloaded like described above.
The search results can be limited to a specific amount of result pages on UG to accelerate the search process by getting fewer results.
Note: The search API also returns types of tabs which are not downloadable with this tool. Results should be filtered before downloading them automatically.
Code examples
Downloading a specific tab:
use get_song_data;
// Downloads and evaluates the tab behind the given URL. The second argument is set to true to automatically replace German chord names. (although this tab doesn't have any)
get_song_data;
Searching for a specific song or artist:
use get_search_results;
// Searches for a given query on only the first page of results (because 0 extra pages are searched)
get_search_results;
Documentation
Code documentation
For further code examples and a detailed documentation, head over to docs.rs.
Changelog
A changelog is available at GitHub.