Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TikTok] Failed to parse JSON/ No video formats found #9506

Open
7 of 9 tasks
seaklin83546 opened this issue Mar 21, 2024 · 84 comments · Fixed by #9548
Open
7 of 9 tasks

[TikTok] Failed to parse JSON/ No video formats found #9506

seaklin83546 opened this issue Mar 21, 2024 · 84 comments · Fixed by #9548
Labels
site-bug Issue with a specific website

Comments

@seaklin83546
Copy link

seaklin83546 commented Mar 21, 2024

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

  • I understand that I will be blocked if I intentionally remove or skip any mandatory* field

Checklist

Please make sure the question is worded well enough to be understood

EDIT:

yt-dlp's TikTok extractor is failing to parse JSON from the feed API endpoint even on nightly/master or with passing --extractor-args "tiktok:api_hostname=api22-normal-c-useast2a.tiktokv.com"

original log for reference
yt-dlp -f "bv*[vcodec^=avc]+ba[ext=m4a]/b[ext=mp4]/b" https://www.tiktok.com/@pouveronica/video/7322479967147740459
[TikTok] Extracting URL: https://www.tiktok.com/@pouveronica/video/7322479967147740459
[TikTok] 7322479967147740459: Downloading video feed
WARNING: [TikTok] Expecting value in '': line 1 column 1 (char 0). Retrying... (attempt 1 of 4)
[TikTok] 7322479967147740459: Downloading video feed
WARNING: [TikTok] Expecting value in '': line 1 column 1 (char 0). Retrying... (attempt 2 of 4)
[TikTok] 7322479967147740459: Downloading video feed
WARNING: [TikTok] Expecting value in '': line 1 column 1 (char 0). Retrying... (attempt 3 of 4)
[TikTok] 7322479967147740459: Downloading video feed
WARNING: [TikTok] 7322479967147740459: Failed to parse JSON (caused by JSONDecodeError("Expecting value in '': line 1 column 1 (char 0)")); trying with webpage
[TikTok] 7322479967147740459: Downloading webpage
[info] 7322479967147740459: Downloading 1 format(s): download
ERROR: unable to open for writing: [Errno 2] No such file or directory: 'Replying to @Vy Puthny some key differences in finance and accounting 😃  #hr #humanresources #hrinsight #hrrole #hrtips #hrtrend #hrknowledge #learning #careergrowth #accounting #finance #manpoweroutsourcing #eor  @Nica - និកា  [7322479967147740459].mp4.part'

Provide verbose output that clearly demonstrates the problem

  • Run your yt-dlp command with -vU flag added (yt-dlp -vU <your command line>)
  • If using API, add 'verbose': True to YoutubeDL params instead
  • Copy the WHOLE output (starting with [debug] Command-line config) and insert it below

Complete Verbose Output

[debug] Command-line config: ['-v', '-U', '-o', '%(title).200B.%(ext)s', 'https://www.tiktok.com/@mix_editor_5/video/7342789941371571462']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version [email protected] from yt-dlp/yt-dlp-master-builds [07f5b2f75] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.22631-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 6.1.1-full_build-www.gyan.dev (setts), ffprobe 6.1.1-full_build-www.gyan.dev, phantomjs 2.5.0, rtmpdump 2.4
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.02.02, curl_cffi-0.5.10, mutagen-1.47.0, requests-2.31.0, sqlite3-3.35.5, urllib3-2.2.1, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets, curl_cffi
[debug] Loaded 1806 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-master-builds/releases/latest
Latest version: [email protected] from yt-dlp/yt-dlp-master-builds
yt-dlp is up to date ([email protected] from yt-dlp/yt-dlp-master-builds)
[TikTok] Extracting URL: https://www.tiktok.com/@mix_editor_5/video/7342789941371571462
[TikTok] 7342789941371571462: Downloading video feed
WARNING: [TikTok] Expecting value in '': line 1 column 1 (char 0). Retrying... (attempt 1 of 4)
[TikTok] 7342789941371571462: Downloading video feed
WARNING: [TikTok] Expecting value in '': line 1 column 1 (char 0). Retrying... (attempt 2 of 4)
[TikTok] 7342789941371571462: Downloading video feed
WARNING: [TikTok] Expecting value in '': line 1 column 1 (char 0). Retrying... (attempt 3 of 4)
[TikTok] 7342789941371571462: Downloading video feed
WARNING: [TikTok] 7342789941371571462: Failed to parse JSON (caused by JSONDecodeError("Expecting value in '': line 1 column 1 (char 0)")); trying with webpage
[TikTok] 7342789941371571462: Downloading webpage
[debug] [TikTok] Found universal data for rehydration
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 7342789941371571462: Downloading 1 format(s): download
[debug] Invoking http downloader on "https://v16-webapp-prime.tiktok.com/video/tos/useast2a/tos-useast2a-ve-0068c004/okMCLjLWAqjFQ5CIXaAfaAiMNgbSzfFCh48fSV/?a=1988&ch=0&cr=3&dr=0&lr=tiktok_m&cd=0%7C0%7C1%7C&cv=1&br=1800&bt=900&bti=ODszNWYuMDE6&cs=0&ds=3&ft=4fUEKMFx8Zmo0H.5Y94jV..7rpWrKsd.&mime_type=video_mp4&qs=0&rc=NGQ5OTY1NTdnaDM0Ojs1ZUBpMzs4N3Q5cnlncTMzNzczM0AzLi9gMi4vNjUxX14uLV4yYSNqZWpoMmQ0NWdgLS1kMTZzcw%3D%3D&btag=e00088000&expire=1711056619&l=20240321153003FA72D5DD8E2EFA514E6F&ply_type=2&policy=2&signature=eb207c9a24f5509f1e4668cbac840d00&tk=tt_chain_token"
[debug] File locking is not supported. Proceeding without locking
[download] Destination: #CapCut #🥺💔 #new #trending #plz #plz #😭😭 #viralvideo #plunfrezzmyaccount🙏🥺 #plzvirulvideo😥 #plzviral🥺🥺🙏🙏foryoupage ⧸⧸ 𝑫𝒆𝒂𝒓 𝑻𝒊𝒌𝒕𝒐𝒌 𝑻.mp4
[download] 100% of    1.62MiB in 00:00:00 at 14.79MiB/s
@seaklin83546 seaklin83546 added the question Question label Mar 21, 2024
@Rizwan-Basheer

This comment was marked as duplicate.

@bashonly

This comment was marked as resolved.

@bashonly bashonly added incomplete Further information is needed site-bug Issue with a specific website and removed question Question labels Mar 21, 2024
@andersgb1
Copy link

andersgb1 commented Mar 21, 2024

yt-dlp --cookies '5.txt' 'https://www.tiktok.com/@mix_editor_5/video/7342789941371571462

Here's with traffic - or would you need some further debug prints around the problematic areas where the parser fails?

--print-traffic log
yt-dlp --print-traffic https://www.tiktok.com/@mix_editor_5/video/7342789941371571462
[TikTok] Extracting URL: https://www.tiktok.com/@mix_editor_5/video/7342789941371571462
[TikTok] 7342789941371571462: Downloading video feed
director: Handler preferences for this request: urllib=0, requests=100, websockets=0
director: Checking if "requests" supports this request.
director: Sending request via "requests"
requests: Starting new HTTPS connection (1): api22-normal-c-useast2a.tiktokv.com:443
send: b'GET /aweme/v1/feed/?aweme_id=7342789941371571462&version_name=26.1.3&version_code=260103&build_number=26.1.3&manifest_version_code=260103&update_version_code=260103&openudid=a278b796c4075c4f&uuid=3521220805091347&_rticket=1711034124680&ts=1711034124&device_brand=Google&device_type=Pixel+7&device_platform=android&resolution=1080%2A2400&dpi=420&os_version=13&os_api=29&carrier_region=US&sys_region=US&region=US&app_name=trill&app_language=en&language=en&timezone_name=America%2FNew_York&timezone_offset=-14400&channel=googleplay&ac=wifi&mcc_mnc=310260&is_my_cn=0&aid=1180&ssmix=a&as=a1qwert123&cp=cbfhckdckkde1 HTTP/1.1\r\nHost: api22-normal-c-useast2a.tiktokv.com\r\nConnection: keep-alive\r\nUser-Agent: com.ss.android.ugc.trill/260103 (Linux; U; Android 13; en_US; Pixel 7; Build/TD1A.220804.031; Cronet/58.0.2991.0)\r\nAccept: application/json\r\nAccept-Language: en-us,en;q=0.5\r\nSec-Fetch-Mode: navigate\r\nAccept-Encoding: gzip, deflate, br\r\nCookie: odin_tt=e21c6b4bc8a8e90409e1ea0752bb9e5aa15483da4046b7489d8653d12d520bde875aef007630ebcf5b3f49f69b50acb636a86e48df5e95e0c94e7dfab1484524594cb325f3a1efbbf95722eaf5cc91da\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Thu, 21 Mar 2024 15:15:25 GMT
header: Content-Type: application/json
header: Content-Length: 0
header: tt_stable: 1
header: tt_orcas_res: 1
header: x-tt-logid: 2024032115152407E836C61AB33B603694
header: tt-idc-switch: 10000@20240321035225
header: Access-Control-Expose-Headers: tt-idc-switch
header: server-timing: inner; dur=12, inner; dur=7
header: x-tt-trace-host: 01a18c0207eb1443e98b5f96c45cf1cd4373b0beb31656d916fb683f620bc0a0520cf0c260bb07ea0bce6ccf0dff603132b52d7f5824e1c91e7e43e0a98b7135c81ac10d25d74301a7eee80f589cff930a28dbc3168891aa304a8db11ab9825e0d
header: x-tt-trace-tag: id=22;cdn-cache=miss
header: x-tt-trace-id: 00-24032115152407E836C61AB33B603694-3A387E66998F413B-00
header: Server: TLB
header: Via: 1.1 google
header: Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
WARNING: [TikTok] Expecting value in '': line 1 column 1 (char 0). Retrying... (attempt 1 of 4)
[TikTok] 7342789941371571462: Downloading video feed
director: Handler preferences for this request: urllib=0, requests=100, websockets=0
director: Checking if "requests" supports this request.
director: Sending request via "requests"
send: b'GET /aweme/v1/feed/?aweme_id=7342789941371571462&version_name=26.1.2&version_code=260102&build_number=26.1.2&manifest_version_code=260102&update_version_code=260102&openudid=062eb56bad513444&uuid=0761932734663454&_rticket=1711034124985&ts=1711034124&device_brand=Google&device_type=Pixel+7&device_platform=android&resolution=1080%2A2400&dpi=420&os_version=13&os_api=29&carrier_region=US&sys_region=US&region=US&app_name=trill&app_language=en&language=en&timezone_name=America%2FNew_York&timezone_offset=-14400&channel=googleplay&ac=wifi&mcc_mnc=310260&is_my_cn=0&aid=1180&ssmix=a&as=a1qwert123&cp=cbfhckdckkde1 HTTP/1.1\r\nHost: api22-normal-c-useast2a.tiktokv.com\r\nConnection: keep-alive\r\nUser-Agent: com.ss.android.ugc.trill/260102 (Linux; U; Android 13; en_US; Pixel 7; Build/TD1A.220804.031; Cronet/58.0.2991.0)\r\nAccept: application/json\r\nAccept-Language: en-us,en;q=0.5\r\nSec-Fetch-Mode: navigate\r\nAccept-Encoding: gzip, deflate, br\r\nCookie: odin_tt=c81b37003864f4074bf472b245cf6d3fc73cc61f87029ff959630d9a07f6b289fbf63d94903dcb2586a28cb676bd92b0a8b055df8d602f42f715b52868d7385ce5b7e8e6dd8cec1ec11bc3a685a0738f\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Thu, 21 Mar 2024 15:15:25 GMT
header: Content-Type: application/json
header: Content-Length: 0
header: tt_stable: 1
header: tt_orcas_res: 1
header: x-tt-logid: 202403211515243AD6D49A723A5732C784
header: tt-idc-switch: 10000@20240321035225
header: Access-Control-Expose-Headers: tt-idc-switch
header: server-timing: inner; dur=17, inner; dur=10
header: x-tt-trace-host: 01a18c0207eb1443e98b5f96c45cf1cd4373b0beb31656d916fb683f620bc0a05251ee12e16f13c76cbbd6e5bd3e5160b1c238937517e2c940eb1539ab06d01a360f336af1a4d926a5da21fa9b17ed422005fbef6ab93f66cfb2cfe6827182d3a6
header: x-tt-trace-tag: id=22;cdn-cache=miss
header: x-tt-trace-id: 00-2403211515243AD6D49A723A5732C784-6628F157A8823DB3-00
header: Server: TLB
header: Via: 1.1 google
header: Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
WARNING: [TikTok] Expecting value in '': line 1 column 1 (char 0). Retrying... (attempt 2 of 4)
[TikTok] 7342789941371571462: Downloading video feed
director: Handler preferences for this request: urllib=0, requests=100, websockets=0
director: Checking if "requests" supports this request.
director: Sending request via "requests"
send: b'GET /aweme/v1/feed/?aweme_id=7342789941371571462&version_name=26.1.1&version_code=260101&build_number=26.1.1&manifest_version_code=260101&update_version_code=260101&openudid=69814748944065e4&uuid=3381622425895293&_rticket=1711034125189&ts=1711034125&device_brand=Google&device_type=Pixel+7&device_platform=android&resolution=1080%2A2400&dpi=420&os_version=13&os_api=29&carrier_region=US&sys_region=US&region=US&app_name=trill&app_language=en&language=en&timezone_name=America%2FNew_York&timezone_offset=-14400&channel=googleplay&ac=wifi&mcc_mnc=310260&is_my_cn=0&aid=1180&ssmix=a&as=a1qwert123&cp=cbfhckdckkde1 HTTP/1.1\r\nHost: api22-normal-c-useast2a.tiktokv.com\r\nConnection: keep-alive\r\nUser-Agent: com.ss.android.ugc.trill/260101 (Linux; U; Android 13; en_US; Pixel 7; Build/TD1A.220804.031; Cronet/58.0.2991.0)\r\nAccept: application/json\r\nAccept-Language: en-us,en;q=0.5\r\nSec-Fetch-Mode: navigate\r\nAccept-Encoding: gzip, deflate, br\r\nCookie: odin_tt=acc0322fb714d841c53466f8e84bfa87cae0da9ffba50dae5402cded9170fcf5a9eb8f23970271e226d4184c54e9a16d2a6586cd6a98dc03389b7f9eec285bfff3e484087954faa4b53fb82e3dd6d63d\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Thu, 21 Mar 2024 15:15:25 GMT
header: Content-Type: application/json
header: Content-Length: 0
header: tt_stable: 1
header: tt_orcas_res: 1
header: x-tt-logid: 20240321151524631C5A08E56FD227A8D2
header: tt-idc-switch: 10000@20240321035225
header: Access-Control-Expose-Headers: tt-idc-switch
header: server-timing: inner; dur=16, inner; dur=9
header: x-tt-trace-host: 01a18c0207eb1443e98b5f96c45cf1cd4373b0beb31656d916fb683f620bc0a0520747c23aba232ed4a1fa91dd81efc2d7760ab5e58d29f9b887d4b018c571de63bf10f30a61eb62e6fb767e4873eb3ac2427bced9d19423067570214e1477239c
header: x-tt-trace-tag: id=22;cdn-cache=miss
header: x-tt-trace-id: 00-240321151524631C5A08E56FD227A8D2-69B93CB981E102DA-00
header: Server: TLB
header: Via: 1.1 google
header: Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
WARNING: [TikTok] Expecting value in '': line 1 column 1 (char 0). Retrying... (attempt 3 of 4)
[TikTok] 7342789941371571462: Downloading video feed
director: Handler preferences for this request: urllib=0, requests=100, websockets=0
director: Checking if "requests" supports this request.
director: Sending request via "requests"
send: b'GET /aweme/v1/feed/?aweme_id=7342789941371571462&version_name=25.6.2&version_code=250602&build_number=25.6.2&manifest_version_code=250602&update_version_code=250602&openudid=1ae36d04e2456d1d&uuid=2020029002446497&_rticket=1711034125394&ts=1711034125&device_brand=Google&device_type=Pixel+7&device_platform=android&resolution=1080%2A2400&dpi=420&os_version=13&os_api=29&carrier_region=US&sys_region=US&region=US&app_name=trill&app_language=en&language=en&timezone_name=America%2FNew_York&timezone_offset=-14400&channel=googleplay&ac=wifi&mcc_mnc=310260&is_my_cn=0&aid=1180&ssmix=a&as=a1qwert123&cp=cbfhckdckkde1 HTTP/1.1\r\nHost: api22-normal-c-useast2a.tiktokv.com\r\nConnection: keep-alive\r\nUser-Agent: com.ss.android.ugc.trill/250602 (Linux; U; Android 13; en_US; Pixel 7; Build/TD1A.220804.031; Cronet/58.0.2991.0)\r\nAccept: application/json\r\nAccept-Language: en-us,en;q=0.5\r\nSec-Fetch-Mode: navigate\r\nAccept-Encoding: gzip, deflate, br\r\nCookie: odin_tt=8261b6f69ac3f90fbce1fdeaed3ab7f4f8274a468bf03af6f33b0895138cbe778c8ca35d7efbef921a460488856d400a2b3099e06cc8819c0dee6cf4a6f15ce1b8c4d4f34d54111caf9bb2a959fe7d98\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Thu, 21 Mar 2024 15:15:25 GMT
header: Content-Type: application/json
header: Content-Length: 0
header: tt_stable: 1
header: tt_orcas_res: 1
header: x-tt-logid: 202403211515247AE03E3D7D5F1F1E54D0
header: tt-idc-switch: 10000@20240321035225
header: Access-Control-Expose-Headers: tt-idc-switch
header: server-timing: inner; dur=12, inner; dur=6
header: x-tt-trace-host: 01a18c0207eb1443e98b5f96c45cf1cd4373b0beb31656d916fb683f620bc0a052bd661ba389b58c5afd0cacc2aa65725f6af3c3ea880e49c2fee06bfd45b0f9be302a9179399f8415cbbcacbb54717fe048b8518411d1c22f4792a401fd89608d
header: x-tt-trace-tag: id=22;cdn-cache=miss
header: x-tt-trace-id: 00-2403211515247AE03E3D7D5F1F1E54D0-7273C6018925BA71-00
header: Server: TLB
header: Via: 1.1 google
header: Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
WARNING: [TikTok] 7342789941371571462: Failed to parse JSON (caused by JSONDecodeError("Expecting value in '': line 1 column 1 (char 0)")); trying with webpage
[TikTok] 7342789941371571462: Downloading webpage
director: Handler preferences for this request: urllib=0, requests=100, websockets=0
director: Checking if "requests" supports this request.
director: Sending request via "requests"
requests: Starting new HTTPS connection (1): www.tiktok.com:443
send: b'GET /@mix_editor_5/video/7342789941371571462 HTTP/1.1\r\nHost: www.tiktok.com\r\nConnection: keep-alive\r\nUser-Agent: Mozilla/5.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-us,en;q=0.5\r\nSec-Fetch-Mode: navigate\r\nAccept-Encoding: gzip, deflate, br\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-Type: text/html; charset=utf-8
header: Content-Security-Policy: script-src 'unsafe-eval' sf16-website-login.neutral.ttwstatic.com s20.tiktokcdn.com *.tiktokcdn-us.com www.google.com recaptcha.google.com js.hcaptcha.com client-api.arkoselabs.com www.gstatic.com connect.facebook.net; frame-src *.tiktok.com accounts.google.com www.google.com recaptcha.google.com www.facebook.com *.kakao.com lf16-web.tiktokcdn.com assets.braintreegateway.com appleid.apple.com access.line.me api.twitter.com h.online-metrix.net bytedance: newassets.hcaptcha.com client-api.arkoselabs.com; worker-src https: blob:; report-to csp-endpoint; upgrade-insecure-requests ; default-src 'self' 'unsafe-eval' 'unsafe-inline' blob: bytedance: data: wss://*.tiktok.com wss://*.tiktokv.com wss://*.tiktokv.eu wss://tiktok.com wss://tiktokv.com *.adsco.re *.akamaized.net *.amazonaws.com *.bing.com *.bitssec.com *.bytedapm.com *.bytedgame.com *.bytehwm-row.com *.byteicdn.com *.byteintl.com *.byteintl.net *.byteintlapi.com *.byteintlstatic.com *.bytelemon.com *.byteoversea.com *.byteoversea.net *.bytevcloudapi.com *.capcut.com *.cloudflare.com *.ctfassets.net *.doubleclick.net *.facebook.com *.facebook.net *.fbsbx.com *.fcdnstatic-intl.com *.fdmstatic.com *.g-p-static.com *.gauthmath.com *.goofy-cdn.com *.goofy.app *.google-analytics.com *.google.ae *.google.at *.google.be *.google.bg *.google.bj *.google.by *.google.ca *.google.ch *.google.co.cr *.google.co.id *.google.co.il *.google.co.jp *.google.co.kr *.google.co.ma *.google.co.nz *.google.co.uk *.google.co.za *.google.com *.google.com.ar *.google.com.au *.google.com.bd *.google.com.br *.google.com.cy *.google.com.do *.google.com.ec *.google.com.gh *.google.com.lb *.google.com.mt *.google.com.my *.google.com.ng *.google.com.pe *.google.com.pk *.google.com.sa *.google.com.sg *.google.com.tr *.google.cz *.google.de *.google.dk *.google.dz *.google.ee *.google.es *.google.fi *.google.fr *.google.gr *.google.hr *.google.hu *.google.ie *.google.iq *.google.is *.google.it *.google.lt *.google.lu *.google.lv *.google.md *.google.nl *.google.no *.google.pl *.google.ps *.google.pt *.google.ro *.google.rs *.google.se *.google.si *.google.sk *.google.td *.google.tn *.googleapis.com *.googletagmanager.com *.gstatic.com *.hsforms.com *.hsforms.net *.ibytedtos.com *.ibyteimg.com *.isnssdk.com *.jumio.ai *.kakao.com *.lemon8-app.com *.lemon8cdn.com *.licdn.com *.linkedin.com *.muscdn.com *.musical.ly *.oecstatic.com *.omise.co *.pangle-ads.com *.paypal.com *.pipopay.com *.redditstatic.com *.resso.me *.sgsnssdk.com *.soundon.global *.tableau.com *.tiktok.com *.tiktok.ru *.tiktok.vn *.tiktokapis.com *.tiktokcdn-eu.com *.tiktokcdn-in.com *.tiktokcdn-us.com *.tiktokcdn.com *.tiktokforbusinessoutbound.com *.tiktokglobalshop.com *.tiktokmusic.me *.tiktokshop.com *.tiktokstaticb.com *.tiktokus.info *.tiktokv.com *.tiktokv.eu *.tiktokv.us *.tiktokw.eu *.tiktokw.us *.topbuzzcdn.com *.ttlivecdn.com *.ttlstatic.com *.ttwstatic.com *.twitter.com *.vimeo.com *.vodupload.com *.yahoo.co.jp *.yhgfb-static.com *.zhiliaoapp.com code.jquery.com facebook.com i.ticketweb.com images.universe.com media.ticketmaster.eu res.cloudinary.com s1.ticketm.net static-label.frontgatetickets.com t.co tikitoks.com tiktok.com tiktok.ua tiktok.vn tiktokfollowersfree.com tiktokv.com twitter.com unpkg.com; report-uri https://mon-i18n.tiktokv.com/monitor_browser/collect/batch/security/?bid=tiktok_pns&revision=083476f4-8c9d-4a06-a20a-349394c7e1b5
header: Feature-Policy: microphone 'none'; geolocation 'none'
header: Referrer-Policy: strict-origin-when-cross-origin
header: Strict-Transport-Security: max-age=31536000; includeSubdomains
header: X-Bytefaas-Execution-Duration: 259.11
header: X-Bytefaas-Request-Id: 202403211515245C8C1D90AA980B4E6732
header: X-Content-Type-Options: nosniff
header: X-Download-Options: noopen
header: X-Frame-Options: SAMEORIGIN
header: X-Gw-Dst-Psm: serverless.tiktok.desktop
header: X-Ms-Token: mbSf6ar-O8PKlAHRCyP9XHSgTY2A-VM6uXrC5KhIv7UwO7kEt5HGiMGdhumCsOmVYaV1lCGS4DsP-eKEeFqudBd5CzmD_2Nc8_8=
header: X-Powered-By: Goofy Node
header: X-Pumbaa-Web-Avail: 1
header: X-Tt-Logid: 202403211515245C8C1D90AA980B4E6732
header: X-Xss-Protection: 1; mode=block
header: Server-Timing: inner; dur=260
header: x-tt-trace-host: 015f26c1ffc64c474bea5b1456b221b90bd5a5e0f69cdac916a1e685fda56c37596aeb56271d525cb3d3a39333f2278ee707eeae4a22a405eadc25cd4b09a4604566de44f773e4f6e3f1608b2483f7bfcc6f6bfac1a41bb867878a6f57a3e31f33
header: x-tt-trace-id: 00-2403211515245C8C1D90AA980B4E6732-67D7BCC16D36A3A5-00
header: reporting-endpoints: csp-endpoint="https://mon-i18n.tiktokv.com/monitor_browser/collect/batch/security/?bid=tiktok_pns"
header: content-security-policy-report-only: report-uri https://mon-i18n.tiktokv.com/monitor_browser/collect/batch/security/?bid=tiktok_pns&revision=083476f4-8c9d-4a06-a20a-349394c7e1b5;report-to csp-endpoint;default-src 'self' 'unsafe-eval' 'unsafe-inline' blob: bytedance: data: wss://*.tiktok.com wss://*.tiktokv.com wss://*.tiktokv.eu wss://tiktok.com wss://tiktokv.com *.adsco.re *.akamaized.net *.amazonaws.com *.bing.com *.capcut.com *.cloudflare.com *.ctfassets.net *.doubleclick.net *.facebook.com *.facebook.net *.fbsbx.com *.fcdnstatic-intl.com *.fdmstatic.com *.g-p-static.com *.gauthmath.com *.google-analytics.com *.googleapis.com *.googletagmanager.com *.gstatic.com *.jumio.ai *.kakao.com *.lemon8-app.com *.lemon8cdn.com *.licdn.com *.linkedin.com *.muscdn.com *.musical.ly *.oecstatic.com *.omise.co *.pangle-ads.com *.paypal.com *.pipopay.com *.redditstatic.com *.resso.me *.sgsnssdk.com *.soundon.global *.tableau.com *.tiktok.com *.tiktok.ru *.tiktok.vn *.tiktokapis.com *.tiktokcdn-eu.com *.tiktokcdn-in.com *.tiktokcdn-us.com *.tiktokcdn.com *.tiktokforbusinessoutbound.com *.tiktokglobalshop.com *.tiktokmusic.me *.tiktokshop.com *.tiktokstaticb.com *.tiktokus.info *.tiktokv.com *.tiktokv.eu *.tiktokv.us *.tiktokw.eu *.tiktokw.us *.topbuzzcdn.com *.ttlivecdn.com *.ttlstatic.com *.ttwstatic.com *.twitter.com *.vimeo.com *.yahoo.co.jp facebook.com t.co tikitoks.com tiktok.com tiktok.ua tiktok.vn tiktokfollowersfree.com tiktokv.com twitter.com unpkg.com
header: Server: TLB
header: Content-Encoding: br
header: Expires: Thu, 21 Mar 2024 15:15:26 GMT
header: Cache-Control: max-age=0, no-cache, no-store
header: Pragma: no-cache
header: Date: Thu, 21 Mar 2024 15:15:26 GMT
header: Transfer-Encoding: chunked
header: X-Cache: TCP_MISS from a23-193-116-188.deploy.akamaitechnologies.com (AkamaiGHost/11.4.3-54729273) (-)
header: Connection: keep-alive
header: Connection: Transfer-Encoding
header: Set-Cookie: ttwid=1%7CerEP1e6NThhY6rk-sIqNOiJJf5pFfn6iZ2NqegIFnXM%7C1711034126%7Cfd2425f5cbe4959d725676d147653762c0b6b1d926993a1ce8365d6a199e882f; Domain=.tiktok.com; Path=/; Expires=Sun, 16 Mar 2025 15:15:26 GMT; HttpOnly
header: Set-Cookie: tt_csrf_token=YLGqKfoa-FROEMRRykhf4FqzXeIxM_PDafpw; path=/; domain=.tiktok.com; samesite=lax; secure; httponly
header: Set-Cookie: tt_chain_token=Srpv1GqLrXwj9vmuSLFCZw==; path=/; expires=Tue, 17 Sep 2024 15:15:26 GMT; domain=.tiktok.com; secure; httponly
header: Set-Cookie: msToken=mbSf6ar-O8PKlAHRCyP9XHSgTY2A-VM6uXrC5KhIv7UwO7kEt5HGiMGdhumCsOmVYaV1lCGS4DsP-eKEeFqudBd5CzmD_2Nc8_8=; Path=/; Expires=Sun, 31 Mar 2024 15:15:25 GMT; Secure; SameSite=None
header: x-tt-trace-tag: id=16;cdn-cache=miss;type=dyn
header: Server-Timing: cdn-cache; desc=MISS, edge; dur=0, origin; dur=347
header: X-Origin-Response-Time: 347,23.193.116.188
header: X-Akamai-Request-ID: 23ea698d
[info] 7342789941371571462: Downloading 1 format(s): download
director: Handler preferences for this request: urllib=0, requests=100, websockets=0
director: Checking if "requests" supports this request.
director: Sending request via "requests"
requests: Starting new HTTPS connection (1): v16-webapp-prime.tiktok.com:443
send: b'GET /video/tos/useast2a/tos-useast2a-ve-0068c004/okMCLjLWAqjFQ5CIXaAfaAiMNgbSzfFCh48fSV/?a=1988&ch=0&cr=3&dr=0&lr=tiktok_m&cd=0%7C0%7C1%7C&cv=1&br=1800&bt=900&bti=ODszNWYuMDE6&cs=0&ds=3&ft=4fUEKMFw8Zmo0D4~Y94jVe2xrpWrKsd.&mime_type=video_mp4&qs=0&rc=NGQ5OTY1NTdnaDM0Ojs1ZUBpMzs4N3Q5cnlncTMzNzczM0AzLi9gMi4vNjUxX14uLV4yYSNqZWpoMmQ0NWdgLS1kMTZzcw%3D%3D&btag=e00088000&expire=1711055740&l=202403211515245C8C1D90AA980B4E6732&ply_type=2&policy=2&signature=b6dddab574fbeeacf324e30b741818ae&tk=tt_chain_token HTTP/1.1\r\nHost: v16-webapp-prime.tiktok.com\r\nConnection: keep-alive\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-us,en;q=0.5\r\nSec-Fetch-Mode: navigate\r\nAccept-Encoding: identity\r\nReferer: https://www.tiktok.com/@mix_editor_5/video/7342789941371571462\r\nCookie: ttwid=1%7CerEP1e6NThhY6rk-sIqNOiJJf5pFfn6iZ2NqegIFnXM%7C1711034126%7Cfd2425f5cbe4959d725676d147653762c0b6b1d926993a1ce8365d6a199e882f; tt_csrf_token=YLGqKfoa-FROEMRRykhf4FqzXeIxM_PDafpw; tt_chain_token=Srpv1GqLrXwj9vmuSLFCZw==\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-Type: video/mp4
header: Content-Length: 1703033
header: ETag: "c23977362524001dfce3a1ecb4dab423"
header: Last-Modified: Tue, 05 Mar 2024 08:15:20 GMT
header: X-Bdcdn-Cache-Status: TCP_HIT
header: X-Storagegw-Request-Id: 20240320183244A2E1BB648F3C04BF65BE
header: X-Storagegw-Response-Time: Wed, 20 Mar 2024 18:32:45 GMT
header: x-request-ip: fdbd:dc61:b:377::41
header: x-response-cinfo: fdbd:dc61:b:377::41
header: x-tt-trace-host: 01a77528bca0d1d95a185688d3d98daf71848bd655a19706a6446dae8bf4042c558e2596990db3c60c2a38c933d77f50b3b2a6b99c547e5c85b115a6de0d209bdf316676394e095703b7c3009169ca7513c9ae4c4fa86361fcd22b75c2f5cc6b5a9948ef49c9795645653983d2c2ba9fe5d7633064c9c34e024adee0d726671f6b
header: x-tt-trace-id: 00-240321100910A83962CC291EA9D3D9DE-5C215D7287A6ED38-00
header: Server: TLB
header: X-TT-LOGID: 20240321100910A83962CC291EA9D3D9DE
header: X-Expires-MS: 1711015752267
header: X-Origin-Response-Time: 11,23.193.39.145
header: X-Akamai-Request-ID: f0f05a1.2c03ca59.2e0d840
header: X-Parent-Response-Time: 414,23.55.160.136
header: Cache-Control: max-age=2592000
header: Date: Thu, 21 Mar 2024 15:15:27 GMT
header: X-Cache: TCP_MISS from a2-16-63-21.deploy.akamaitechnologies.com (AkamaiGHost/11.4.3-54729273) (-)
header: Connection: keep-alive
header: X-Cache-Remote: TCP_MISS from a23-55-160-136.deploy.akamaitechnologies.com (AkamaiGHost/11.4.3-54726453) (-)
header: x-response-cache: parent_hit
header: x-tt-trace-tag: id=16;cdn-cache=hit;type=static
header: Server-Timing: cdn-cache; desc=HIT, edge; dur=457, origin; dur=0
header: Server-Timing: inner; dur=2
header: X-Parent-Response-Time: 457,2.16.63.21
header: Access-Control-Expose-Headers: Content-Length,Content-Range,content-type,expires,last-modified,via,X-Cache,x-response-cache,x-response-sinfo,x-response-cinfo
header: Accept-Ranges: bytes
header: Access-Control-Allow-Headers: range
header: Access-Control-Allow-Credentials: true
header: Access-Control-Allow-Origin: https://www.tiktok.com
ERROR: unable to open for writing: [Errno 36] File name too long: "#CapCut #🥺💔 #new #trending #plz #plz #😭😭 #viralvideo #plunfrezzmyaccount🙏🥺 #plzvirulvideo😥 #plzviral🥺🥺🙏🙏foryoupage ⧸⧸ 𝑫𝒆𝒂𝒓 𝑻𝒊𝒌𝒕𝒐𝒌 𝑻𝒆𝒂𝒎 𝑷𝒍𝒛 𝑫𝒐𝒏'𝒕 𝑼𝒏𝒅𝒆𝒓𝒓𝒆𝒗𝒊𝒆𝒘 𝑴𝒚 𝑽𝒊𝒅𝒆𝒐 🥺🙏😞💔 ⧸⧸#FORYOU #FORYOUPAGE#STANDWITHKASHMIR#dontunderreviewmyvideo #watsappstatus  [7342789941371571462].mp4.part"

@bashonly bashonly removed the incomplete Further information is needed label Mar 21, 2024
@bashonly bashonly changed the title TikTok can't download Failed to parse JSON (caused by JSONDecodeError("Expecting value in '': line 1 column 1 (char 0)")); trying with webpage [TikTok] Failed to parse JSON - part 2 Mar 21, 2024
@seproDev

This comment was marked as resolved.

@andersgb1

This comment was marked as resolved.

@seproDev

This comment was marked as resolved.

@Rizwan-Basheer

This comment was marked as duplicate.

1 similar comment
@Rizwan-Basheer

This comment was marked as duplicate.

@bashonly
Copy link
Member

bashonly commented Mar 21, 2024

yt-dlp should still be able to download the webpage version of the video in most cases. Try adding -f 0 to your command to select the format without a watermark. The quality will not be quite as good as the mobile API feed formats, though.

ERROR: unable to open for writing: [Errno 2] No such file or directory
ERROR: unable to open for writing: [Errno 22] Invalid argument:

If you get an error like this, it just means the output filename is too long. Add -o "%(title).100B [%(id)s].%(ext)s" to your command

@bashonly
Copy link
Member

Also, should note that for 1 out of every ~30 attempts, I don't receive this error and I am still able to get the mobile API feed formats.

@Rizwan-Basheer
Copy link

Rizwan-Basheer commented Mar 21, 2024

i want data in json and it returns but when i open the video url in my browser i get access deneid
Access Denied i try to open this url in different browsers but result is same
You don't have permission to access "http://v16-webapp-prime.tiktok.com/video/tos/useast2a/tos-useast2a-ve-0068c003/o0lJmAxvtJdSiEIlb5FfBBQ0R1U7RYQQRfD1E8/?" on this server.
Reference #18.9584dead.1711040325.fc05b85

@Rizwan-Basheer
Copy link

actually i think when ever i make request tiktok send a captcha with 403 response and ytdlp give me back this page 🤔 if i'm right than how can i solve this issue i also try proxy but nothing changed

@mrzenc

This comment was marked as resolved.

@nodata168

This comment was marked as spam.

@xuen97

This comment was marked as duplicate.

@nodata168

This comment was marked as off-topic.

@bruno0157

This comment was marked as resolved.

@austin2035
Copy link

sorry for asking questions here but I need to know if there's ANY other way of downloading in full quality (watermarked or not) from the webpage. i'm not web literate, so I'm not sure if it's possible to manually access a video through your browser or something, but since i've never seen a mention of it i'm guessing it's not? just wanna be sure很抱歉在这里提问,但我需要知道是否有任何其他方法可以从网页下载全质量(水印或无水印)。我不懂网络,所以我不确定是否可以通过浏览器或其他东西手动访问视频,但由于我从未见过提及它,我猜它不是?只是想确定一下

try it, work well.

https://www.tiktokarchive.com/

@timmbobb

This comment was marked as off-topic.

@nodata168

This comment was marked as spam.

@bashonly

This comment was marked as resolved.

@oifj34f34f
Copy link

oifj34f34f commented Apr 14, 2024

@1RandomDev Try this: https://julien.duponchelle.info/android/use-proxy-with-waydroid

And then add the iid from the https://api16-core-c-alisg.tiktokv.com/aweme/v2/feed/ request in mitmweb to ~/.config/yt-dlp/config (or you can use mine):

--extractor-args 'tiktok:api_hostname=api16-normal-c-useast1a.tiktokv.com;app_info=7355728856979392262'

@Neurotoxin001
Copy link

I apologize for the off-topic, but I have an idea.

Why not add to yt-dlp the ability to specify the login and password of my ticktock account? Because if I open the videos in my browser, they don't have watermarks on them. And in google chrome console there are such requests:

https://v16-webapp-prime.tiktok.com/video/tos/alisg/tos-alisg-pve-censored/censored/?a=censored&bti=censored&ch=0&cr=3&dr=0&lr=unwatermarked&cd=censored&cv=1&br=censored&bt=censored&cs=0&ds=6&ft=-censored&mime_type=video_mp4&qs=0&rc=censored&btag=censored&expire=censored&l=censored&ply_type=2&policy=2&signature=censored&tk=tt_chain_token&__vid=TT-vCache-censored

And there is this parameter:

lr=unwatermarked.

But if I open the link from this query in a new tab, there will be 403 error. But maybe you can teach yt-dlp to download videos from such requests.

@wmooring
Copy link

wmooring commented Apr 14, 2024

If a logon would help, couldn't yt-dlp just get the session info from the browser using "--cookies-from-browser [browser]", the same way it works for Youtube? (using that doesn't seem to help with the issue currently)

@renandecarlo

This comment was marked as resolved.

@bashonly

This comment was marked as resolved.

@shreyakannan1205

This comment was marked as resolved.

@zulfiqarlaili

This comment was marked as resolved.

@shreyakannan1205

This comment was marked as resolved.

@zulfiqarlaili

This comment was marked as resolved.

@zulfiqarlaili

This comment was marked as duplicate.

@bashonly

This comment was marked as resolved.

@bashonly
Copy link
Member

bashonly commented Apr 18, 2024

Please read all of the comments that haven't been resolved/marked as duplicate in this issue before asking questions

@zulfiqarlaili

This comment was marked as resolved.

@schleeb
Copy link

schleeb commented Apr 19, 2024

A workaround is to pass:

--extractor-arg "tiktok:api_hostname=api16-normal-c-useast1a.tiktokv.com;app_info=INFO"

replacing INFO with the actual app info such as a working iid, or iid/app_name pair, etc

edit: fixed typo in original extractor-arg example

Using this, and the app_info=7355728856979392262 someone else provided, I'm able to download without watermarks, but when I compare the available formats and resulting downloads to a few existing files I'd downloaded previously, I'm finding they're lower quality - is this iid dependent? Is it api dependent?

@bashonly
Copy link
Member

bashonly commented Apr 19, 2024

but when I compare the available formats and resulting downloads to a few existing files I'd downloaded previously, I'm finding they're lower quality - is this iid dependent? Is it api dependent?

not iid dependent. and we are using the same API endpoint. TikTok is a hostile moving target, it's not realistic to expect consistency

@goldensun87

This comment was marked as duplicate.

aalsuwaidi pushed a commit to aalsuwaidi/yt-dlp that referenced this issue Apr 21, 2024
Closes yt-dlp#9506
Authored by: bashonly, Grub4K

Co-authored-by: Simon Sawicki <[email protected]>
@BurningAlfalfa
Copy link

this issue is still ongoing for me

@renandecarlo
Copy link

BurningAlfalfa

Now you need to get and add your own iid on extractor args from tiktok app. Read @oifj34f34f #9506 (comment)

@sami155
Copy link

sami155 commented May 9, 2024

BurningAlfalfa

Now you need to get and add your own iid on extractor args from tiktok app. Read @oifj34f34f #9506 (comment)

But you cant use this with Seal (Android App) i think. It's there a way to make this work with Seal?

@oifj34f34f
Copy link

@sami155 JunkFood02/Seal#1478

@xfeeefeee
Copy link

trying to grab my own iid with a mitm has been quite a frustrating endeavor, but I'm glad it at least exists as an option. now we need a marketplace of iids for people to purchase 😹

@renandecarlo
Copy link

trying to grab my own iid with a mitm has been quite a frustrating endeavor, but I'm glad it at least exists as an option. now we need a marketplace of iids for people to purchase 😹

Easiest way is on PC with Android Emulator + HTTP Toolkit

@BurningAlfalfa
Copy link

PC with Android Emulator + HTTP Toolkit

I'm currently trying this, I can see a gourp id and a trace id but no iid

@pthieu
Copy link

pthieu commented May 14, 2024

adding -f 0 worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site-bug Issue with a specific website
Projects
None yet
Development

Successfully merging a pull request may close this issue.