Unofficial Async shitty API wrapper to get information about the monstercat live stream using TheAkio's website (MCTL) and aiohttp
I'm a python beginner, I don't really know what I'm doing, your contributions are gladly accepted.
pip install monstercatFM
pip install git+https://github.com/Zenrac/monstercatFM
- Python3+
- aiohttp
- asyncio
- bs4
Handler to get the current song forever
import asyncio
from monstercatFM import monstercat
async def hand(msg):
print("New song : {} by {}".format(msg[0], msg[1]))
mc = monstercat.Client() # Can specify a loop if needed
mc.register_handler(hand)
to_run = mc.start()
mc.loop.run_until_complete(to_run)
Gets the current song only
from monstercatFM import monstercat
mc = monstercat.Client() # Can specify a loop if needed
to_run = mc.get_current_song()
msg = mc.loop.run_until_complete(to_run)
print("New song : {} by {}".format(msg[0], msg[1]))
Gets old already played tracks
from monstercatFM import monstercat
requested_tracks = 50
mc = monstercat.Client() # Can specify a loop if needed
to_run = mc.get_old_tracks(requested_tracks)
msg = mc.loop.run_until_complete(to_run)
for i, song in enumerate(msg, start=1):
print("{} - {} by {}".format(i, song[0], song[1]))
- If the loop is already running, replace
run_until_complete(to_run)
with
mc.loop.create_task(to_run)
- Value accepted to get old tracks are :
15, 25, 50, 100
(default is15
)
This project is licensed under the MIT License - see the LICENSE file for details