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

[zattoo] Fix broken extractor (closes #22258) #28253

Closed
wants to merge 3 commits into from

Conversation

goggle
Copy link
Contributor

@goggle goggle commented Feb 23, 2021

Please follow the guide below

  • You will be asked some questions, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your pull request (like that [x])
  • Use Preview tab to see how your pull request will actually look like

Before submitting a pull request make sure you have:

In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

  • Bug fix
  • Improvement
  • New extractor
  • New feature

Description of your pull request and other information

This PR fixes the currently broken Zattoo information extractor.
It supersedes my old PR #22759, which does not work anymore because of changes in the initialization process.
Note that this PR only fixes Zattoo, not the Zattoo resellers (I do not have access to any of them).

If this should be merged, someone with a Zattoo Premium account needs to provide account credentials to a maintainer of youtube-dl!

@goggle
Copy link
Contributor Author

goggle commented Feb 23, 2021

I'm not sure why the URL matching tests are failing. If anyone sees an easy fix, just tell me.

@remitamine
Copy link
Collaborator

remitamine commented Feb 23, 2021

I think it's caused by | in the ZattooIE._VALID_URL_TEMPLATE:


that causes the second part of the regex:
(?:
.+\?recording=([0-9]+)|
.+\?video=([A-Za-z0-9]+)|
.+\?channel=([^&]+)(?:
&program=(\d+)
)?
)'''

to match regardless of domain.

@orangerkater
Copy link

orangerkater commented Mar 10, 2021

If this should be merged, someone with a Zattoo Premium account needs to provide account credentials to a maintainer of youtube-dl!

To whom and how shall I provide the credentials? @dstftw, @remitamine?

@orangerkater
Copy link

orangerkater commented Apr 15, 2021

They did not react until now. Is by chance any other maintainer interested?

@0x4d4e
Copy link

0x4d4e commented Nov 23, 2021

I tried to download a recording from Zattoo and it only worked after these changes (based on the source branch of this merge request). I did not further troubleshoot the changes in _real_extract - they work for downloading recordings and since I won't be using Zattoo any further this is all that I was after.

FYI: if someone needs credentials to check the changes, there is the option to use the free trial of Zattoo (30days, CC/Paypal required).

index 11a20c27e..a7c2c6ff0 100644
--- a/youtube_dl/extractor/zattoo.py
+++ b/youtube_dl/extractor/zattoo.py
@@ -300,7 +300,8 @@ class ZattooIE(ZattooBaseIE):
                                 (?:
                                     ondemand/videos/([A-Za-z0-9]+)|
                                     (?:program|watch)/([^/]+)/(\d+)|
-                                    live/([^/]+)
+                                    live/([^/]+)|
+                                    recording/([0-9]+)
                                 )|
                                 (?:
                                     .+\?recording=([0-9]+)|
@@ -342,11 +343,12 @@ class ZattooIE(ZattooBaseIE):
     }]

     def _real_extract(self, url):
-        oid1, cid1, pid1, cid2, record_id, oid2, cid3, pid2 = re.match(
+        oid1, cid1, pid1, cid2, rid1, rid2, oid2, cid3, pid2, = re.match(
             self._VALID_URL, url).groups()
         ondemand_id = oid1 or oid2
         channel_id = cid1 or cid2 or cid3
         program_id = pid1 or pid2
+        record_id = rid1 or rid2
         if record_id:
             return self._extract_record(record_id)
         elif ondemand_id:

@goggle
Copy link
Contributor Author

goggle commented Apr 8, 2022

If anyone is interested: A follow-up PR has been merged into yt-dlp: yt-dlp/yt-dlp#2288

@goggle goggle closed this Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants