allow pcm /live to enter channel link

remotes/1693176582716663532/tmp_refs/heads/watchparty
Aevann1 2022-09-25 08:45:19 +02:00
parent 8a85c2413c
commit 5a97a6f6e6
2 changed files with 6 additions and 4 deletions

View File

@ -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"}

View File

@ -99,7 +99,7 @@
{% if v and v.admin_level > 1 %}
<form action="/live/add" method="post">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input class="form-control" style="display:inline;width:350px" autocomplete="off" type="text" name="id" class="form-control" placeholder="Enter channel id or name.." maxlength="24" required>
<input class="form-control" style="display:inline;width:350px" autocomplete="off" type="text" name="link" class="form-control" placeholder="Enter channel link.." required>
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" onclick="disable(this)" value="Add Youtube Channel" style="margin-bottom:5px">
</form>
{% endif %}