From eefc5120e6a5cbfedd5c1369d58d99cf05f18b35 Mon Sep 17 00:00:00 2001 From: KV-Tube Deployer Date: Sun, 18 Jan 2026 21:47:31 +0700 Subject: [PATCH] chore: cleanup debug scripts and logs --- benchmark_ytdlp.py | 55 ---------- debug_api.log | 8 -- debug_fetch.log | 3 - debug_paths.txt | 2 - debug_ytfetcher_standalone.py | 81 --------------- execution_trace.txt | 3 - restore_cookies.py | 185 ---------------------------------- server_debug.log | Bin 10008 -> 0 bytes server_log.txt | Bin 1230 -> 0 bytes verify_fix.py | 20 ---- 10 files changed, 357 deletions(-) delete mode 100644 benchmark_ytdlp.py delete mode 100644 debug_api.log delete mode 100644 debug_fetch.log delete mode 100644 debug_paths.txt delete mode 100644 debug_ytfetcher_standalone.py delete mode 100644 execution_trace.txt delete mode 100644 restore_cookies.py delete mode 100644 server_debug.log delete mode 100644 server_log.txt delete mode 100644 verify_fix.py diff --git a/benchmark_ytdlp.py b/benchmark_ytdlp.py deleted file mode 100644 index a762ecf..0000000 --- a/benchmark_ytdlp.py +++ /dev/null @@ -1,55 +0,0 @@ -import time -import sys -import subprocess -import json -import yt_dlp - -QUERY = "latest smart technology gadgets reviews" -LIMIT = 20 - -def test_subprocess(): - start = time.time() - cmd = [ - sys.executable, "-m", "yt_dlp", - f"ytsearch{LIMIT}:{QUERY}", - "--dump-json", - "--flat-playlist", - "--no-playlist", - "--no-warnings" - ] - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) - out, err = proc.communicate() - end = time.time() - count = len(out.splitlines()) - return end - start, count - -def test_library(): - start = time.time() - ydl_opts = { - 'headers': {'User-Agent': 'Mozilla/5.0'}, - 'skip_download': True, - 'extract_flat': True, - 'noplaylist': True, - 'quiet': True, - 'no_warnings': True, - } - with yt_dlp.YoutubeDL(ydl_opts) as ydl: - res = ydl.extract_info(f"ytsearch{LIMIT}:{QUERY}", download=False) - count = len(res.get('entries', [])) - end = time.time() - return end - start, count - -if __name__ == "__main__": - print("Benchmarking Subprocess...") - try: - sub_time, sub_count = test_subprocess() - print(f"Subprocess: {sub_time:.4f}s (Fetched {sub_count} items)") - except Exception as e: - print(f"Subprocess Failed: {e}") - - print("\nBenchmarking Library...") - try: - lib_time, lib_count = test_library() - print(f"Library: {lib_time:.4f}s (Fetched {lib_count} items)") - except Exception as e: - print(f"Library Failed: {e}") diff --git a/debug_api.log b/debug_api.log deleted file mode 100644 index ccce502..0000000 --- a/debug_api.log +++ /dev/null @@ -1,8 +0,0 @@ -Batch fetching for: ['IpqiLXy4im8', 'o_rtfAazE5s', 'VexXHSzibxY', 'U2oEJKsPdHo', 'dQw4w9WgXcQ', 'h22z894ThnQ', 'Fp7FcfGNpWg', 'z_G_8i95SMA'] -Using python: C:\Program Files\Python312\python.exe -Command prepared: ['C:\\Program Files\\Python312\\python.exe', '-m', 'yt_dlp'] ... [len:16] -Result lines: 8 -Batch fetching for: ['IpqiLXy4im8', 'o_rtfAazE5s', 'VexXHSzibxY', 'U2oEJKsPdHo', 'dQw4w9WgXcQ', 'h22z894ThnQ', 'Fp7FcfGNpWg', 'z_G_8i95SMA'] -Using python: C:\Program Files\Python312\python.exe -Command prepared: ['C:\\Program Files\\Python312\\python.exe', '-m', 'yt_dlp'] ... [len:16] -Result lines: 8 diff --git a/debug_fetch.log b/debug_fetch.log deleted file mode 100644 index 488a885..0000000 --- a/debug_fetch.log +++ /dev/null @@ -1,3 +0,0 @@ -Fetching for qZvqydUEzqA... -Results type: -Results is empty/None. diff --git a/debug_paths.txt b/debug_paths.txt deleted file mode 100644 index 01bbe8e..0000000 --- a/debug_paths.txt +++ /dev/null @@ -1,2 +0,0 @@ -APP: C:\Users\Admin\Documents\Projects-Khoa.vo\kv-tube\current\kv-tube\app\__init__.py -API: C:\Users\Admin\Documents\Projects-Khoa.vo\kv-tube\current\kv-tube\app\routes\api.py diff --git a/debug_ytfetcher_standalone.py b/debug_ytfetcher_standalone.py deleted file mode 100644 index d5fec5a..0000000 --- a/debug_ytfetcher_standalone.py +++ /dev/null @@ -1,81 +0,0 @@ -from ytfetcher import YTFetcher -from ytfetcher.config import HTTPConfig -import random -import os -import http.cookiejar -import logging - -# Configure logging -logging.basicConfig(level=logging.INFO) -logger = logging.getLogger(__name__) - -def debug_fetch(video_id): - try: - # 1. Prepare Cookies if available - cookie_header = "" - cookies_path = 'cookies.txt' - - if os.path.exists(cookies_path): - try: - cj = http.cookiejar.MozillaCookieJar(cookies_path) - cj.load() - cookies_list = [] - for cookie in cj: - cookies_list.append(f"{cookie.name}={cookie.value}") - cookie_header = "; ".join(cookies_list) - logger.info(f"Loaded {len(cookies_list)} cookies for YTFetcher") - except Exception as e: - logger.warning(f"Failed to process cookies: {e}") - - # 2. Configuration to look like a real browser - user_agents = [ - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15", - "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0" - ] - - headers = { - "User-Agent": random.choice(user_agents), - "Accept-Language": "en-US,en;q=0.9", - } - - # Inject cookie header if we have it - if cookie_header: - headers["Cookie"] = cookie_header - - config = HTTPConfig(headers=headers) - - print(f"Initializing YTFetcher for {video_id}...") - # Initialize Fetcher - fetcher = YTFetcher.from_video_ids( - video_ids=[video_id], - http_config=config, - languages=['en', 'en-US', 'vi'] - ) - - # Fetch - print(f"Fetching transcripts...") - results = fetcher.fetch_transcripts() - - print(f"Results type: {type(results)}") - print(f"Results length: {len(results) if results else 0}") - - if results: - data = results[0] - if data.transcripts: - print("Transcript found!") - text_lines = [t.text.strip() for t in data.transcripts if t.text.strip()] - print(f"First 3 lines: {text_lines[:3]}") - else: - print("No transcripts inside data object.") - # Maybe print available tracks if possible? - else: - print("Results is empty.") - - except Exception as e: - import traceback - print(f"CRITICAL ERROR: {e}") - print(traceback.format_exc()) - -if __name__ == "__main__": - debug_fetch("qZvqydUEzqA") diff --git a/execution_trace.txt b/execution_trace.txt deleted file mode 100644 index d690daf..0000000 --- a/execution_trace.txt +++ /dev/null @@ -1,3 +0,0 @@ -Unique videos count: 5 -IDs to hydrate: ['AlGfj9JBdAI', 'MhQGDAGVIa8', 'Fp7FcfGNpWg', 'Z2KlYnsPaIk', 'f_4uUX9n538'] -Metadata map keys: ['MhQGDAGVIa8', 'Fp7FcfGNpWg', 'AlGfj9JBdAI', 'Z2KlYnsPaIk', 'f_4uUX9n538'] diff --git a/restore_cookies.py b/restore_cookies.py deleted file mode 100644 index 01fa870..0000000 --- a/restore_cookies.py +++ /dev/null @@ -1,185 +0,0 @@ -import json -import time - -cookies_data = [ - { - "domain": ".youtube.com", - "expirationDate": 1802692356.635205, - "hostOnly": False, - "httpOnly": True, - "name": "__Secure-3PSID", - "path": "/", - "sameSite": "no_restriction", - "secure": True, - "session": False, - "storeId": None, - "value": "g.a0005gie1lAkmYZc-EPeGx77pCrXo_Cz5eAi-e9aryb9Qoz967v4Caiou6Tt5ZyLR4iMp5I51wACgYKASISARESFQHGX2MiopTeGBKXybppZWNr7JzmKhoVAUF8yKrgfPx-gEb02gGAV3ZaVOGr0076" - }, - { - "domain": ".youtube.com", - "expirationDate": 1800281710.070798, - "hostOnly": False, - "httpOnly": True, - "name": "__Secure-1PSIDTS", - "path": "/", - "sameSite": None, - "secure": True, - "session": False, - "storeId": None, - "value": "sidts-CjQB7I_69DRJdiQQGddE6tt-GHilv2IjDZd8S6FlWCjx2iReOoNtQMUkb55vaBdl8vBK7J_DEAA" - }, - { - "domain": ".youtube.com", - "expirationDate": 1802692356.635439, - "hostOnly": False, - "httpOnly": False, - "name": "SAPISID", - "path": "/", - "sameSite": None, - "secure": True, - "session": False, - "storeId": None, - "value": "DP6iRyLCM_cFV1Gw/AN2nemkVrvJ2p8MWb" - }, - { - "domain": ".youtube.com", - "expirationDate": 1800281710.070999, - "hostOnly": False, - "httpOnly": True, - "name": "__Secure-1PSIDCC", - "path": "/", - "sameSite": None, - "secure": True, - "session": False, - "storeId": None, - "value": "AKEyXzU66C7YKqYKgxpR8BbWvDlICFaXQCERc_NLnU_QLkcHrmR0aPQJTFLW1WesYcSYtIJYW3o" - }, - { - "domain": ".youtube.com", - "expirationDate": 1802692356.635327, - "hostOnly": False, - "httpOnly": True, - "name": "SSID", - "path": "/", - "sameSite": None, - "secure": True, - "session": False, - "storeId": None, - "value": "A4isk9AE9xActvzYy" - }, - { - "domain": ".youtube.com", - "expirationDate": 1802692356.635505, - "hostOnly": False, - "httpOnly": False, - "name": "__Secure-1PAPISID", - "path": "/", - "sameSite": None, - "secure": True, - "session": False, - "storeId": None, - "value": "DP6iRyLCM_cFV1Gw/AN2nemkVrvJ2p8MWb" - }, - { - "domain": ".youtube.com", - "expirationDate": 1802692356.635139, - "hostOnly": False, - "httpOnly": True, - "name": "__Secure-1PSID", - "path": "/", - "sameSite": None, - "secure": True, - "session": False, - "storeId": None, - "value": "g.a0005gie1lAkmYZc-EPeGx77pCrXo_Cz5eAi-e9aryb9Qoz967v4-rF3xTavVHrJoyJAqShH6gACgYKAX0SARESFQHGX2MiOdAbUPmCj4MueYyh-2km5RoVAUF8yKp2ehWQC6tX8n-9UNg11RV60076" - }, - { - "domain": ".youtube.com", - "expirationDate": 1802692356.635559, - "hostOnly": False, - "httpOnly": False, - "name": "__Secure-3PAPISID", - "path": "/", - "sameSite": "no_restriction", - "secure": True, - "session": False, - "storeId": None, - "value": "DP6iRyLCM_cFV1Gw/AN2nemkVrvJ2p8MWb" - }, - { - "domain": ".youtube.com", - "expirationDate": 1800281710.071036, - "hostOnly": False, - "httpOnly": True, - "name": "__Secure-3PSIDCC", - "path": "/", - "sameSite": "no_restriction", - "secure": True, - "session": False, - "storeId": None, - "value": "AKEyXzUv06PBPrBxCnsrFCJPVRWYCKjXadcrSQPokD-DHGumtiOBRC96ipf2COBQcX_7RjiO8g" - }, - { - "domain": ".youtube.com", - "expirationDate": 1800281710.070914, - "hostOnly": False, - "httpOnly": True, - "name": "__Secure-3PSIDTS", - "path": "/", - "sameSite": "no_restriction", - "secure": True, - "session": False, - "storeId": None, - "value": "sidts-CjQB7I_69DRJdiQQGddE6tt-GHilv2IjDZd8S6FlWCjx2iReOoNtQMUkb55vaBdl8vBK7J_DEAA" - }, - { - "domain": ".youtube.com", - "expirationDate": 1792154873.499957, - "hostOnly": False, - "httpOnly": True, - "name": "LOGIN_INFO", - "path": "/", - "sameSite": "no_restriction", - "secure": True, - "session": False, - "storeId": None, - "value": "AFmmF2swRQIgVjJk8Mho4_JuKr6SZzrhBdlL1LdxWxcwDMu4cjaRRgcCIQCTtJpmYKJH54Tiei3at3f4YT3US7gSL0lW_TZ04guKjQ:QUQ3MjNmeWlwRDJSNDl2NE9uX2JWWG5tWllHN0RsNUVZVUhsLVp4N2dWbldaeC14SnNybWVERnNoaXFpanFJczhKTjJSRGN6MEs3c1VkLTE1TGJVeFBPT05BY29NMFh0Q1VPdFU3dUdvSUpET3lQbU1ZMUlHUGltajlXNDllNUQxZHdzZko1WXF1UUJWclNxQVJ0TXVEYnF2bXJRY2V6Vl9n" - }, - { - "domain": ".youtube.com", - "expirationDate": 1803304605.839449, - "hostOnly": False, - "httpOnly": False, - "name": "PREF", - "path": "/", - "sameSite": None, - "secure": True, - "session": False, - "storeId": None, - "value": "tz=Etc.GMT-7&f7=150" - } -] - -def json_to_netscape(json_cookies, output_file): - with open(output_file, 'w') as f: - f.write("# Netscape HTTP Cookie File\n") - f.write("# This file is generated by a script.\n\n") - - for cookie in json_cookies: - domain = cookie.get('domain', '') - # Netscape format requires domain to start with . for subdomains usually, - # flag TRUE/FALSE depends on if it's a domain cookie. - # Simplified: - flag = "TRUE" if domain.startswith('.') else "FALSE" - path = cookie.get('path', '/') - secure = "TRUE" if cookie.get('secure', False) else "FALSE" - expiration = str(int(cookie.get('expirationDate', 0))) - name = cookie.get('name', '') - value = cookie.get('value', '') - - f.write(f"{domain}\t{flag}\t{path}\t{secure}\t{expiration}\t{name}\t{value}\n") - - print(f"Successfully converted {len(json_cookies)} cookies to {output_file}") - -if __name__ == "__main__": - json_to_netscape(cookies_data, 'cookies.txt') diff --git a/server_debug.log b/server_debug.log deleted file mode 100644 index f7229bbb2499682b9b702f2e891c13663e02be95..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10008 zcmds->rxxZ700_O-%_$rhCahY4=-f_Eb%k2SI z-H>a|Z2*nAYuveOg3|@NOIw$gV}37bZMZMoZ{1^BGv9VX+nQVCtq%RF8~HcklxVxk z_Z+%y=#+hX=KchRIE~yJ|NB>{H{pK)+ra`Y;DD1pWyM|k#%>>dn&{sJw+qz32ATWvzp(KdG{;CF547D^Pnn{Kj2*ZXFj zzCKqKx(#>*Y~!Kd>+$piUT0n+(_@UUGe*j~U0~T+Z)U9_wA;MpUNgmH*F(Y+Ru%4M zjdyV?gEN4eXy(L@jW;VQCZ&fgnfd6hyB@HOkUomts*hhq{WxQZ5KulEA9 zB}3-qhZo3j!WH~rxmWYmJyfAzD}I#^(g5XRP4}z4nwK?Zr?R`?>I7C)>AjWo^$Iw5 zrv)sH;`mVkcaR~r=Lwv)Ul#2(v<&#F2m;(h@&GIAMOf8^y_vK%bdJ4Ik{Z4U?fpb5 z<>1h+FIlw1C6=9c-_S412b{EZT(s5;DP|cJxz>}Bje?U&+8`nV)e~lCfE#4E04p=i z`*`Xm@~bss1pQ}yJjC{BB}HUtZ@Hrc?k0ToRgPFe2a~mp?9oo`WYlpYS1-X)jt$h5 zX#?C&WN#;4RVD~Hs_0Vqym;&Kos2y}UX!sy3`Vg$^%5C+%tE7M684CVNV%8HnNgxwFY#8-&-WlpFVU%&#IU|&0Y_im2*(IJ zPUJdHY^`c3j4&zHlG2MaqF?AUi|pxqiuUa%w&*8(+KIhXQw16O$!tme*Z27?V5#0W z*ksguj0DZkD6ziRaa_zZ19D|(SB8#o%w2;dQdAqpo?+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n*BDf?WBJWyGYtSK63{M~+5y|-Z5xWuJhTtyD|$AOvIMq99PqAl?~=zaVVNEJ zD~#2slKY8!9jq5z+S9A>ZWKj-n>U?~s%HbLbCWYKt$B6!bVC0*(rSOML#+L(piQG2&N6hRVd> zSG8<<+v;@wW?HYHdFDAEz^?)%556k6>_cDjnfGjO@&S>kZ<2Des%@V#XfFIa95Nv(FC0a9j=sK&>Op>-n?9}mg mx4^H{GKQylLOzOCQfnA(I>vWtnCf@E0=&bwTK13orT+$*51@wt diff --git a/server_log.txt b/server_log.txt deleted file mode 100644 index 7064839944116d23180c0c3699f16483e96bc4ea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1230 zcmb`H&2Q8&5XI+=#Q)$E0+n3}j(b3=mR4GU%9r3mP?g<;t)cs&#M>4Q{OQ2&jbl;} zH;|RY9*^I=c{9$B?|b`V$u4YXTMIVhS=gDK+6(5j?HMzB$}I6Ld3tN{iFikB5z8g- zuUH$qYj^AzYjE2Z+sq!ZT7h3%=PUUfVf#JqXS=d<$L^T5_)gs;*b{sev)IqU-r1V{ zWH%n`F+TT*Q;@&e{~kgP!w~m5*(5lvVbY=B0yRD|FFv=wQuK_yWN*l*MT>}UWY(ZZ zu>1d@_YBMg165;f4?ufwAM7FD*WhnFYHKIxv|_!-K4zlYspg|4cwJ8IfWnt#^@>@p zZsB`Etd3J1oEy+`Zqg!p)#mJN7&W*Jaf^43q4zQNX5bq*6Y)tyoB+q|U=y>AuhmTn zTy=~hU3ku_8Cq|E~t8TAuNv=