Add soundcloud support

This commit is contained in:
BarsTiger
2023-11-13 23:08:58 +02:00
parent e99ba9daa3
commit bc2663c17c
22 changed files with 391 additions and 7 deletions

View File

@@ -9,11 +9,12 @@ from bot.modules.database.db import DBDict
from bot.modules.youtube import youtube
from bot.modules.spotify import spotify
from bot.modules.deezer import deezer
from bot.modules.soundcloud import soundcloud
@dataclass
class RecognisedService:
name: Literal['yt', 'spot', 'deez']
name: Literal['yt', 'spot', 'deez', 'sc']
db_table: DBDict
by_id_func: Callable | Awaitable
parse_result: ParseResult
@@ -42,5 +43,12 @@ def recognise_music_service(url: str) -> RecognisedService | None:
by_id_func=deezer.songs.from_id,
parse_result=url
)
elif url.netloc.endswith('soundcloud.com'):
return RecognisedService(
name='sc',
db_table=db.soundcloud,
by_id_func=soundcloud.songs.from_url,
parse_result=url
)
else:
return None