From 5a97a6f6e64eb2fce839100c7f811b3fc0e35222 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 25 Sep 2022 08:45:19 +0200 Subject: [PATCH] allow pcm /live to enter channel link --- files/routes/static.py | 8 +++++--- files/templates/live.html | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/files/routes/static.py b/files/routes/static.py index e1d15bb9d..d7dfcac7a 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -544,10 +544,12 @@ if SITE == 'pcmemes.net': if v.id not in (AEVANN_ID, KIPPY_ID, 1550): return {"error": 'Only Kippy can add channels!'}, 403 - id = request.values.get('id').strip() + link = request.values.get('link').strip() - if not id.startswith('UC'): - text = requests.get(f'https://www.youtube.com/c/{id}', cookies={'CONSENT': 'YES+1'}, timeout=5, proxies=proxies).text + if 'youtube.com/channel/' in link: + id = link.split('youtube.com/channel/')[1].rstrip('/') + else: + text = requests.get(link, cookies={'CONSENT': 'YES+1'}, timeout=5, proxies=proxies).text try: id = id_regex.search(text).group(1) except: return {"error": "Invalid ID"} diff --git a/files/templates/live.html b/files/templates/live.html index d529f3708..d21108799 100644 --- a/files/templates/live.html +++ b/files/templates/live.html @@ -99,7 +99,7 @@ {% if v and v.admin_level > 1 %}
- +
{% endif %}