Unofficial Python API for vgmusic.com.


Keywords
python3, vgmusic
License
MIT
Install
pip install vgmusic==0.1.0a0

Documentation

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.