yt-dlp: [TubiTV] JSONDecodeError -- detect geo-block and add `--geo-verification-proxy` support
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
- I’m reporting that yt-dlp is broken on a supported site
- I’ve verified that I’m running yt-dlp version 2023.07.06 (update instructions) or later (specify commit)
- I’ve checked that all provided URLs are playable in a browser with the same IP and same login details
- I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
- I’ve searched known issues and the bugtracker for similar issues including closed ones. DO NOT post duplicates
- I’ve read the guidelines for opening an issue
- I’ve read about sharing account credentials and I’m willing to share it if required
Region
America
Provide a description that is worded well enough to be understood
When I use yt-dlp -F tubitvlink
I get this following error. Failed to parse JSON (caused by JSONDecodeError("Expecting value in '': line 1 column 1 (char 0)"));
this started happing only on 2022-09-03.
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
toYoutubeDL
params instead - Copy the WHOLE output (starting with
[debug] Command-line config
) and insert it below
Complete Verbose Output
—REMOVED—
About this issue
- Original URL
- State: open
- Created 10 months ago
- Comments: 33 (15 by maintainers)
I mean it currently defaults to this:
[debug] Using fake IP 6.10.104.246 (US) as X-Forwarded-For [TubiTv] Extracting URL: https://tubitv.com/tv-shows/351987/s01-e01-blues
Possibly because of this?
_GEO_COUNTRIES = ['US']
If I try to download a show that’s available in Australia but not US, it will fail. It also doesn’t allow me to download US shows so it’s useless. I have to use --no-geo-bypass to fix the issue.
I don’t see /oz/ anywhere in the urls.
The tokens are specific to country, though:
so swapping an
AU
token into aUS
manifest URL might not do any goodThe JWT is in the manifest link. And the JWT expires:
you can’t change the exp time because of the above-mentioned signature
The JWTs are signed. Unless the signing key can be found in client-side JS (which is rare, but known to happen), it’s impossible
My EU, non-English speaking 😜, country gets the
https://gdpr.tubi.tv/
page in English, when trying to access https://tubitv.com/movies/501355The same redirection takes place when trying to access directly the
json
“page”https://tubitv.com/oz/videos/501355/content
…From a US IP address (via HTTPS proxy):
https://tubitv.com/oz/videos/501355/content
yields this; quoting:
OTOH, from an AU IP address (via HTTPS proxy):
https://tubitv.com/oz/videos/501355/content
yields this, with
i.e. it’ll become available in Down Under imminently and shall remain available there for half a year…
Obviously, I can’t see a way for an American TubiTV user to tell that the same title is or isn’t available in Oz, or, conversely, for an Aussie TubiTV user to tell that the same title isn’t or is available (at the same time) in the States 😉 … But I could be wrong, what do I know? 😄
No. The extractor does this by default, and as Jules-A said above:
Not sure what you are trying to say? It didn’t launch with Australia support but added on September 1, 2019.
Also, https://en.wikipedia.org/w/index.php?title=Tubi#Global_availability. The article as a whole doesn’t support an Australian origin theory.
Or maybe the site devs were just following the yellow brick road …
For
/oz/
, see https://github.com/yt-dlp/yt-dlp/issues/8018#issuecomment-1704310119, or the extractor source; otherwise, you confirmed what I thought.That could explain this in the JSON API URL:
Adding the geo-verification-proxy support only has an effect if you specify a proxy. I guess
--no-geo-bypass
is what’s meant above? Obviously the XFF tactic fails for this site and should be disabled.It’s also available in Australia but has significantly less titles. Last time I tried the extractor over a year ago the extractor failed because of the forced US geo proxy causing 403s if I could recall. I had to disable the proxy to get it to work… I haven’t checked the code but does this take in to account that Australians can also watch it and don’t want a forced US IP?
It does not
Yes, it does.
self.geo_verification_headers()
needs to be added to the headers for the request(s) where proxy is neededCan you please check if that currently works for that site? Surely support for that option doesn’t have to be added to each extractor, does it?
Can’t repro from US IP: