Skip to main content

Python library to download your favorited tabs from Ultimate-Guitar.com

Project description

Ultimate Guitar Scraper

Python library to download your favorited tabs from Ultimate-Guitar.com.

PyPI version PyPI - Downloads

What Works

  • Favorites: Download all your liked tabs (requires cookies)
  • Tab Content: Get individual tab content by URL

What Doesn't Work Yet

Search is broken. Cloudflare blocks automated searches pretty consistently. If you want to help fix this, PRs are welcome. For now, use the UG website to find tabs, favorite them, then use this to download.

Installation

From PyPI (recommended)

pip install ultimate-guitar-scraper

For Cloudflare bypass support:

pip install ultimate-guitar-scraper[cloudflare]

From source

git clone https://github.com/yourusername/ug_api.git
cd ug_api
pip install -e .

Usage

Get your cookies from browser DevTools (F12 → Application → Cookies → ultimate-guitar.com). You need SESSIONUG and bbsessionhash.

from ug_api import UGScraper

cookies = {
    'SESSIONUG': 'your_session_cookie_here',
    'bbsessionhash': 'your_bb_session_here'
}

scraper = UGScraper(cookies)

# Get your favorites
result = scraper.get_favorites()
for tab in result['favorites']:
    print(f"{tab['artist']} - {tab['title']} ({tab['type']})")
    print(f"  URL: {tab['url']}")

# Download a specific tab
tab = scraper.get_tab("https://tabs.ultimate-guitar.com/tab/...")
if not tab['error']:
    print(tab['content'])

How to Get Cookies

  1. Open Ultimate-Guitar.com in your browser
  2. Log in
  3. Press F12 to open DevTools
  4. Go to Application tab → Cookies → ultimate-guitar.com
  5. Copy the values for SESSIONUG and bbsessionhash
  6. Paste them into the cookies dict

API

UGScraper(cookies)

Initialize with your UG session cookies.

Args:

  • cookies (dict): Your UG cookies including SESSIONUG and bbsessionhash

get_favorites()

Get all your favorited tabs.

Returns:

{
    'favorites': [
        {
            'title': 'Song Name',
            'artist': 'Artist Name',
            'type': 'Chords',
            'url': 'https://...',
            'liked_at': '2024-01-01'
        }
    ],
    'error': None
}

get_tab(url)

Download tab content from a URL.

Returns:

{
    'title': 'Song Name',
    'artist': 'Artist Name',
    'content': '...',
    'url': 'https://...',
    'error': None
}

Known Issues

  • No search: Cloudflare blocks search requests. Favorite tabs manually on the website first.
  • Official tabs: Can't download official/licensed tabs
  • Rate limiting: Use cookies to avoid getting blocked

Contributing

Search functionality needs work. If you figure out a way around Cloudflare's bot detection, please submit a PR.

Publishing to PyPI

To publish this package:

# Install build tools
pip install build twine

# Build the package
python -m build

# Upload to PyPI (you'll need PyPI account credentials)
python -m twine upload dist/*

For TestPyPI (testing):

python -m twine upload --repository testpypi dist/*

License

AGPL-3.0-or-later - Educational use only. Respect UG's ToS.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ultimate_guitar_scraper-0.1.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ultimate_guitar_scraper-0.1.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file ultimate_guitar_scraper-0.1.1.tar.gz.

File metadata

  • Download URL: ultimate_guitar_scraper-0.1.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for ultimate_guitar_scraper-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9a41e8c7da134f614555c585fb4d2409f356693eea73df9f0f50b254371f4ee9
MD5 3ac289e44d3eacf41ad7213b5ab0d5ca
BLAKE2b-256 38d9b2a55848a258339356e945de56a01c82fad93c5b729d63085984e6b0666c

See more details on using hashes here.

File details

Details for the file ultimate_guitar_scraper-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ultimate_guitar_scraper-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 068f2350d8cb16365aa2ff9f6900280ecf955d48f9dbee8077579a31f5a4128a
MD5 0c736bfc02e0d2010f3af03235933b6c
BLAKE2b-256 a6aa7acc29c558366a27665a2af31c1fddbab1956749a0bd83067d4c03361721

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page