From 15d2de5228445748960ed690fb57c760647815a0 Mon Sep 17 00:00:00 2001 From: sherl Date: Fri, 5 Sep 2025 18:51:09 +0200 Subject: [PATCH] chore: change the hostname in default config to match the one assumed (if not explicitly passed to the script, e.g. when running with flask) --- config.default.toml | 2 +- ythdd_globals.py | 4 ++-- ythdd_inv_tl.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config.default.toml b/config.default.toml index f85c8b0..5a7f7fe 100644 --- a/config.default.toml +++ b/config.default.toml @@ -2,7 +2,7 @@ db_file_path = "/path/to/ythdd_db.sqlite" # Preferably stored on an SSD. video_storage_directory_path = "/path/to/videos/" # Path to video vault. is_proxied = false # Set to true if running behind reverse proxy. -public_facing_url = "http://localhost:5000/" # Used for URL rewriting. Note the trailing backslash /. +public_facing_url = "http://127.0.0.1:5000/" # Used for URL rewriting. Note the trailing backslash /. debug = false # Whether to print verbose, debug info on API endpoints. cache = true # Whether to cache requests for 3 hours (temporary solution to long load times). diff --git a/ythdd_globals.py b/ythdd_globals.py index c3fa4b3..da090f6 100644 --- a/ythdd_globals.py +++ b/ythdd_globals.py @@ -31,7 +31,7 @@ def getConfig(configfile): global randomly_generated_passcode if not os.path.exists(configfile): - dummy_config = {'general': {'db_file_path': 'ythdd_db.sqlite', 'video_storage_directory_path': 'videos/', 'is_proxied': False, 'public_facing_url': 'http://localhost:5000/', 'debug': False, 'cache': True}, 'api': {'api_key': 'CHANGEME'}, 'extractor': {'user-agent': '', 'cookies_path': ''}, 'admin': {'admins': ['admin']}, 'yt_dlp': {}, 'postprocessing': {'presets': [{'name': 'recommended: [N][<=720p] best V+A', 'format': 'bv[height<=720]+ba', 'reencode': ''}, {'name': '[N][1080p] best V+A', 'format': 'bv[height=1080]+ba', 'reencode': ''}, {'name': '[R][1080p] webm', 'format': 'bv[height=1080]+ba', 'reencode': 'webm'}, {'name': '[N][720p] best V+A', 'format': 'bv[height=720]+ba', 'reencode': ''}, {'name': '[R][720p] webm', 'format': 'bv[height=720]+ba', 'reencode': 'webm'}, {'name': '[N][480p] best V+A', 'format': 'bv[height=480]+ba', 'reencode': ''}, {'name': '[480p] VP9 webm/reencode', 'format': 'bv*[height=480][ext=webm]+ba/bv[height=480]+ba', 'reencode': 'webm'}, {'name': '[N][1080p] best video only', 'format': 'bv[height=1080]', 'reencode': ''}, {'name': '[N][opus] best audio only', 'format': 'ba', 'reencode': 'opus'}]}} + dummy_config = {'general': {'db_file_path': 'ythdd_db.sqlite', 'video_storage_directory_path': 'videos/', 'is_proxied': False, 'public_facing_url': 'http://127.0.0.1:5000/', 'debug': False, 'cache': True}, 'api': {'api_key': 'CHANGEME'}, 'proxy': {'user-agent': ''}, 'extractor': {'user-agent': '', 'cookies_path': ''}, 'admin': {'admins': ['admin']}, 'yt_dlp': {}, 'postprocessing': {'presets': [{'name': 'recommended: [N][<=720p] best V+A', 'format': 'bv[height<=720]+ba', 'reencode': ''}, {'name': '[N][1080p] best V+A', 'format': 'bv[height=1080]+ba', 'reencode': ''}, {'name': '[R][1080p] webm', 'format': 'bv[height=1080]+ba', 'reencode': 'webm'}, {'name': '[N][720p] best V+A', 'format': 'bv[height=720]+ba', 'reencode': ''}, {'name': '[R][720p] webm', 'format': 'bv[height=720]+ba', 'reencode': 'webm'}, {'name': '[N][480p] best V+A', 'format': 'bv[height=480]+ba', 'reencode': ''}, {'name': '[480p] VP9 webm/reencode', 'format': 'bv*[height=480][ext=webm]+ba/bv[height=480]+ba', 'reencode': 'webm'}, {'name': '[N][1080p] best video only', 'format': 'bv[height=1080]', 'reencode': ''}, {'name': '[N][opus] best audio only', 'format': 'ba', 'reencode': 'opus'}]}} # if a passcode has not been provided by the user (config file doesn't exist, and user didn't specify it using an argument) print(f"{colors.WARNING}WARNING{colors.ENDC}: Using default, baked in config data. {colors.ENDL}" f" Consider copying and editing the provided example file ({colors.OKCYAN}config.default.toml{colors.ENDC}).") @@ -59,7 +59,7 @@ def getHeaders(caller="proxy"): # NOTE: use ESR user-agent # user_agent = 'Mozilla/5.0 (Windows NT 10.0; rv:130.0) Gecko/20100101 Firefox/130.0' - user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0' + user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0) Gecko/20100101 Firefox/142.0' if config[caller]['user-agent']: user_agent = config[caller]['user-agent'] diff --git a/ythdd_inv_tl.py b/ythdd_inv_tl.py index da792fd..8a35383 100644 --- a/ythdd_inv_tl.py +++ b/ythdd_inv_tl.py @@ -560,7 +560,7 @@ def videos(data): "liveNow": live_now, "isPostLiveDvr": post_live_dvr, "isUpcoming": is_upcoming, - "dashUrl": ythdd_globals.config['general']['public_facing_url'] + "/dash/not/implemented/", # not implemented + "dashUrl": ythdd_globals.config['general']['public_facing_url'] + "dash/not/implemented/", # not implemented "premiereTimestamp": premiere_timestamp, #"hlsUrl": hls_url, # broken after a change in iOS player