-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Vrtnu running with username and password: age restriction not handled correctly #29044
Comments
Same problem, even with v2021.05.16 |
It's got something to do with the |
To get a valid youtube-dl/youtube_dl/extractor/canvas.py Line 65 in dfbbe29
This identityToken can be found in the X-VRT-Token cookie, however for me this cookie differs between youtube-dl and my browser.
|
Is it possible to replace the incorrect token by the right one in the cmd line request? |
dear @MatthiasCoppens thanks for your clear description of the problem. I don't quite understand how to add an identityToken to the POST request. I naively tried to add a Firefox cookie to test in headers.update({'Content-Type': 'application/json'})
headers.update({'X-VRT-Token': 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL3Rva2VuLnZydC5iZSIsInN1YiI6IjYyOWE0ZThjZWQ1MzQxNDdhNTE3ZGI1OGM1YWE3NWZiIiwibmV3c3ViIjoiYjllOWY1ZGEtMDUwYy00NWQ0LWI4NzAtZjE5ZDFhOWZiZWY2IiwiY291IjoiQkUiLCJhZ2UiOjMzLCJhdWQiOiIvdnJ0bnUiLCJpYXQiOjE2MjE3NzUxNzgsImV4cCI6MTYyMTc3ODc3OCwiYWMiOiIxNisifQ.VNZoO0ZwgOezUt60So-j0cDkS8mtcg_2Kxf4ZtCeVCmw-Z5tsQfR5Ji0HVEWhWKz8ejN4B20d5XmD59KZCYkZgdGmqvhwA1_8vedi9xbFakXKDNHOYmqEjBrPOYa3Og5D7VYJHqnas2HXg-MrhPfKu0ECKqO9aS64Df0QMDUxXN9Y1ulIvNfiA0lX3cbSeBMoWZ5HUSKA7POLLWLgmnhiFKic1Lm7w4Pi7RNDw0Ri8oNaWr9ZYtVWKdrz3Y1STZRSsDmemnvFIz1-gLQJek73jBnbei20iG_TNvkuHCfWtiXIKBcBFv_Sih0S426Bsgr4pb4Io4yw8O3dGLwjLa7zfS_BGce8qwTno3cevkg5aeJBQA-8q3Uc9LR2deM0AxjHOfiME6ds9r9zqS7D7DKo2DtcrA-xJmhPs7e7aLkG5h32dEqoSpFkQmU_bvWU43TRzZ7tvNEgHTSV-HaZvCe8y877ckoBkec2rBtIpeeuL-YMsEA68xPUqOaPN8tIS5xy1NUPXcVs7MNaJbXRCIb2peHL15Dl2rQimPTWSsSM4o1HjjXM-f_TDC4jlHsjnQYMB1OBrkYwP6sKBMwwkd-C6lyvAeBwYKngXkP8w6bBpY5-JQhARVN1hKXMNgSBcT1_QmdMB3Jw9qhMDY-uPTfz2FvIbzwGbB_cvAGUEAyNa8'}) but I can't get it to work. |
@sharethewisdom: This enables me to download https://www.vrt.be/vrtnu/a-z/before-we-die/2/before-we-die-s2a1/: headers.update({'Content-Type': 'application/json'})
identityToken = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL3Rva2VuLnZydC5iZSIsInN1YiI6IjY3NmJjMTk1MDAwNzQ1MWFiMTU2NGNjYjI5NTdmZjJjIiwibmV3c3ViIjoiMTQ1ODRjZmUtMjllNC00NzZhLWI1NDEtYjM5MWJhOTc3M2U4IiwiY291IjoiQkUiLCJhZ2UiOjI0LCJhdWQiOiIvdnJ0bnUiLCJpYXQiOjE2MjE3Nzg2MDgsImV4cCI6MTYyMTc4MjIwOCwiYWMiOiIxNisifQ.g8lM8aQX9tVacP9OUz8EAplGac76v5P9wBT8DlXGoDwQvVLncNcafnZiI5OYwVsClcMJBScAsRVKdgSXPXWT9DuPhlfyUs49zpgz-Xb05NHDAIFuFxv0DTNOB9FJEqcMGho4ehl5_524ZoIa9PavlzmPRee-Y9HKw1f-E3o3rkws73GFYAkOhTjXqo55Gg3_HCOqfJEqgKrYzvF-ILMmY9XRqVmn4c1Fw5tTcBspt77h6nKkpb6S231BQELTurJtF7-zwixuKSwZZbdhnruTFUUYlPMK4Y71ZP8PmIapappGXuf7r162FqHEVMgX1UmxWgVdHBPGzaCrNsTZtM3jWzgSlsaopN9u78cKs1N7MKxqXmD2har2a1FJBMDT0XK-oqlMRF8afTnaNEMlHixpz8M-Y4xOcDiUCPmhSCPCiLxJVmcApMM-h_jixwE04eHMYAEndseWp5cZAkz7R3p0oGmrTnYne5xTEJ5-myq3HLtzGfsAkq873e0PepEqv4mDvEEQOUWzmOL44TUQboPv8Ju267Jk3stTBhUcXvKLoFDHmvFJxj_a77QSrnLtaSvLpIqQKjvigC6JejVjwHfe3TQuBDMdeZoH3maW0s9dyM3cK6fMLTI6eS0lqQ3Oct2YM3kvV3XHGO70QD_pLpCY1YbE2YpteWZbfC-2PY-5dP0"
post_data = json.dumps({"identityToken": identityToken}).encode()
token = self._download_json(
'%s/tokens' % self._REST_API_BASE, video_id,
'Downloading token',
data=post_data,
headers=headers)['vrtPlayerToken'] |
I can get a working curl 'https://token.vrt.be/refreshtoken' -H 'Cookie: vrtlogin-rt=...' -I |
thanks, you're so clever, that works 🥳 (but now, how to fix canvas.py...) I initially tried |
When you don't have the youtube-dl/youtube_dl/extractor/canvas.py Line 283 in dfbbe29
# Sometimes authentication fails for no good reason, retry
login_attempt = 1
while login_attempt <= 3:
try:
# This request should set the cookie OIDCXSRF
self._request_webpage(
'https://token.vrt.be/vrtnuinitlogin?provider=site&destination=https://www.vrt.be/vrtnu/',
None,
note='Initializing login',
errnote='Could not initialize login',
)
# This request should set the cookie X-VRT-Token
post_data = {
'UID': auth_info['UID'],
'UIDSignature': auth_info['UIDSignature'],
'signatureTimestamp': auth_info['signatureTimestamp'],
'client_id': 'vrtnu-site',
}
for cookie in self._downloader.cookiejar:
if cookie.name == 'OIDCXSRF':
post_data['_csrf'] = cookie.value
break
self._request_webpage(
'https://login.vrt.be/perform_login?client_id=vrtnu-site',
None,
note='Requesting a token',
errnote='Could not get a token',
headers={
'Content-Type': 'application/x-www-form-urlencoded',
},
data=json.dumps(post_data).encode('utf-8'),
)
except ExtractorError as e:
if isinstance(e.cause, compat_HTTPError) and e.cause.code == 401: The second request fails (403: the server understood the request, but is refusing to authorize it). In browser this request sends some extra cookies to the server, not sure where they come from or which ones are important. |
Hi, Is there a fix available for the canvas.py file. Many thanks |
See also Kodi's VRT NU add-on bug add-ons/plugin.video.vrt.nu#882 and fix add-ons/plugin.video.vrt.nu#885; apparantly age restricted content now requires a "user" X-VRT-Token instead of the legacy token (recent change on VRT side). Matthias' #29044 (comment) works for me. |
Works for me too now. Was a little bit of a search for the correct cookie (vrtnu-site_profile_vt). |
I'm in the middle of my exams, so I can't really do a lot of troubleshooting right now, but the code at #29044 (comment) seems very similar to add-ons/plugin.video.vrt.nu#885 so this shouldn't take a lot of tweaking to get it to work. |
No problem Matthias. Your code at #29044 (comment) works for me. I only have to replace the value of the identityToken by the actual value of the 'vrtnu-site_profile_vt' cookie from www.vrt.be. However this cookie has a short lifetime, as a result many 'make youtube-dl' commands. |
I wrote a fix #29614 heavily inspired from add-ons/plugin.video.vrt.nu#885 and the comments above. Seems to work for me + fixes the authentication issue #29534 . |
Until the linked PR is merged (and released) you can always download from vrtNU this way: #29534 (comment) |
Checklist
Verbose log
Description
Can not download age restricted video from https://www.vrt.be/vrtnu/ (e.g. https://www.vrt.be/vrtnu/a-z/petra/1/petra-s1a2/), although my account allows playing it.
An account can be made from the site: https://www.vrt.be/vrtnu/
The text was updated successfully, but these errors were encountered: