diff options
author | Pawky Languish | 2024-11-28 03:18:20 +0000 |
---|---|---|
committer | Pawky Languish | 2024-11-28 03:18:20 +0000 |
commit | 763f96948f39a20d79f7ec68a924966c2b3db761 (patch) | |
tree | 4b522062a472d0cbd87210f7e57a779651ae0a1a /soundcloud.py | |
parent | 1c083501b82eba4e927988bc84547ba76bb6f513 (diff) |
add tests and make youtube use oembed (no more bot block, at the cost of VERY minimal info)
Diffstat (limited to 'soundcloud.py')
-rwxr-xr-x | soundcloud.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/soundcloud.py b/soundcloud.py index ae17f9d..a1f5f91 100755 --- a/soundcloud.py +++ b/soundcloud.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -from urllib.parse import urlencode, urlparse from urllib.request import urlopen +from urllib.parse import urlencode, urlparse from json import loads as json_loads @@ -29,7 +29,7 @@ class SoundCloud: url = f"https://soundcloud.com/oembed?{urlencode([('url',url),('format','json')])}" data = urlopen(url).read().decode() data = json_loads(data) - print(data) + #print(data) # print(data["title"].removesuffix(" by "+data["author_name"]),data["author_name"]) try: artist = data["author_name"] @@ -37,7 +37,7 @@ class SoundCloud: except KeyError: title = "" artist = "" - print(title.removesuffix(" by " + artist), "|", artist) + #print(title.removesuffix(" by " + artist), "|", artist) if title == "": irc_string = "[\x0304SoundCloud\x03] \x0307ERROR:\x0308 got no data from server! \x0315(check your URL for typos!)\x03" ansi_string = "[\x1b[31mSoundCloud\x1b[0m] \x1b[33;2mERROR:\x1b[33;1m got no data from server! \x1b[37;2m(check your URL for typos!)\x1b[0m" |