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

[tf1] fix wat id extraction (closes ytdl-org#21365) #21372

Closed
wants to merge 9 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions youtube_dl/extractor/tf1.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

from .common import InfoExtractor

from youtube_dl.utils import (
RegexNotFoundError,
froiss marked this conversation as resolved.
Show resolved Hide resolved
)

class TF1IE(InfoExtractor):
"""TF1 uses the wat.tv player."""
Expand Down Expand Up @@ -61,7 +64,13 @@ class TF1IE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
wat_id = self._html_search_regex(
r'"streamId":"(?P<id>\d{8})"',
webpage, 'wat id', group='id')
try:
wat_id = self._html_search_regex(
# the old pattern. Should no longer work as of 2019-06-12
r'(["\'])(?:https?:)?//www\.wat\.tv/embedframe/.*?(?P<id>\d{8})\1',
webpage, 'wat id', group='id')
except RegexNotFoundError:
wat_id = self._html_search_regex(
r'\bstreamId\W+(?P<id>\d+)',
froiss marked this conversation as resolved.
Show resolved Hide resolved
webpage, 'wat id', group='id')
froiss marked this conversation as resolved.
Show resolved Hide resolved
return self.url_result('wat:%s' % wat_id, 'Wat')