Skip to main content

Unofficial Python API for vgmusic.com.

Project description

vgmusic.py

Code style: black PyPI - Downloads PyPI - License PyPI PyPI - Python Version Lines of code

(unofficial) Python API for VGMusic. This project is in no way affiliated with or sponsered by Mike Newman or any of the staff at VGMusic.

Caches

vgmusic.py relies heavily on caches to avoid downloading VGMusic pages repeatedly; the CLI auto-caches for you into a cache.json file.

An example of a cache file is at the root of this repo; it is a pre-parsed full dump of info (direct links, authors, etc.) on all the songs currently on VGMusic. It weighs in at 8.5 MB as JSON (6 MB without indentation).

Usage

Thoughout these examples, we will be using the API object as the api:

import vgmusic

api = vgmusic.API()

It is recommended to close it once you are done:

# do something here...
api.close()

The best way is to use a context manager, a.k.a with statement:

with vgmusic.API() as api:
    # do something here

Note that the API is lazy: It will only retrieve data for a console/system the first time it is queried for it. To override this behaviour, use force_cache (see Module Documentation).

Module Documentation

See API.md.

CLI

The command-line interface can be used to download MIDI files concurrently (useful for scripting).

Make sure to install the CLI extra first:

pip install vgmusic[cli]

For more info on how to use the cli, run vgmusic --help.

REST

Install the rest extension:

pip install vgmusic[rest]

and start the server with python3 -m vgmusic.rest.

For docs, visit here once you've started the server.

License

MIT.

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

vgmusic-1.0.2.tar.gz (1.5 MB view hashes)

Uploaded Source

Built Distribution

vgmusic-1.0.2-py3-none-any.whl (9.6 kB view hashes)

Uploaded Python 3

Supported by

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