Require youtube PO token
This commit is contained in:
parent
35c9bda23f
commit
4fd92f7834
3 changed files with 7 additions and 1 deletions
|
@ -1,4 +1,6 @@
|
||||||
TOKEN=""
|
TOKEN=""
|
||||||
|
PO_TOKEN=""
|
||||||
|
COOKIES_FILE=""
|
||||||
GUILD_ID=""
|
GUILD_ID=""
|
||||||
QUEUE_PATH=""
|
QUEUE_PATH=""
|
||||||
MAX_MIN="8"
|
MAX_MIN="8"
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -31,6 +31,7 @@ share/python-wheels/
|
||||||
*.egg
|
*.egg
|
||||||
*.mp4
|
*.mp4
|
||||||
*.vtt
|
*.vtt
|
||||||
|
cookies*
|
||||||
testing/
|
testing/
|
||||||
*.db
|
*.db
|
||||||
next*
|
next*
|
||||||
|
|
|
@ -81,6 +81,9 @@ ydl_opts = {
|
||||||
'match_filter': video_check,
|
'match_filter': video_check,
|
||||||
'hls_prefer_native': True,
|
'hls_prefer_native': True,
|
||||||
'extract_flat': 'discard_in_playlist',
|
'extract_flat': 'discard_in_playlist',
|
||||||
|
'cookiefile': f'{os.getenv("COOKIES_FILE")}',
|
||||||
|
'extractor_args': {'youtube': {'player_client': ['web', 'default'],
|
||||||
|
'po_token': [f'web+{os.getenv("PO_TOKEN")}']}},
|
||||||
'format': 'bestvideo[height<=1080][vcodec!*=av01][ext=mp4]+bestaudio[abr<=256][ext=m4a]/best[ext=mp4]/best',
|
'format': 'bestvideo[height<=1080][vcodec!*=av01][ext=mp4]+bestaudio[abr<=256][ext=m4a]/best[ext=mp4]/best',
|
||||||
'fragment_retries': 10,
|
'fragment_retries': 10,
|
||||||
'noplaylist': True,
|
'noplaylist': True,
|
||||||
|
@ -154,7 +157,7 @@ def download_video(index):
|
||||||
sleep(2) #allow ytdlp to fully cleanup
|
sleep(2) #allow ytdlp to fully cleanup
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("handling youtube exception")
|
print("handling youtube exception")
|
||||||
if "Sign in to confirm" in str(e):
|
if "Sign in to confirm" in str(e) or "forbidden" in str(e).lower():
|
||||||
print("youtube ban detected")
|
print("youtube ban detected")
|
||||||
#This is the worst possible case and therefore all activity must halt
|
#This is the worst possible case and therefore all activity must halt
|
||||||
obs.set_current_program_scene("banned")
|
obs.set_current_program_scene("banned")
|
||||||
|
|
Loading…
Reference in a new issue