1
0
Fork 0
forked from swee/MeowNex
This commit is contained in:
Nova Cat 2024-12-17 16:27:26 -08:00
parent 1e5d2fc29b
commit 773fcd1b5e

View file

@ -51,13 +51,10 @@ def get_yt_id(url):
if query.hostname in {'www.youtube.com', 'youtube.com', 'music.youtube.com'}: if query.hostname in {'www.youtube.com', 'youtube.com', 'music.youtube.com'}:
# URLs that have the ID in the path instead of the query. # URLs that have the ID in the path instead of the query.
integrated_in_url = ["watch", "embed", "v", "shorts"] integrated_in_url = ["watch", "embed", "v", "shorts"]
try: # The regular /watch path, which stores the ID in the query.
# The regular /watch path, which stores the ID in the query. if query.path == '/watch': return parse_qs(query.query)['v'][0]
if query.path == '/watch': return parse_qs(query.query)['v'][0] # Alternatively, it will get the ID in the path if the path was in the list above.
# Alternatively, it will get the ID in the path if the path was in the list above. elif query.path.split('/')[1] in integrated_in_url: return query.path.split('/')[2]
elif query.path.split('/')[1] in integrated_in_url: return query.path.split('/')[2]
except:
return None
class config: class config:
def __init__(self): def __init__(self):
self.conn = sqlite3.connect(environ["SBconfig"]) self.conn = sqlite3.connect(environ["SBconfig"])
@ -680,6 +677,7 @@ while True:
else: else:
raise Exception("No special URL, go ahead and parse the normal title...") raise Exception("No special URL, go ahead and parse the normal title...")
except: except:
print(traceback.formal_exc())
e = get(i, headers=headers, timeout=10) e = get(i, headers=headers, timeout=10)
header = e.headers header = e.headers
content_type = header.get('content-type').split(";")[0] content_type = header.get('content-type').split(";")[0]