]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/ynet.py
[ie/box] Fix formats extraction (#8649)
[yt-dlp.git] / yt_dlp / extractor / ynet.py
CommitLineData
2a1325fd 1import json
ac668111 2import re
3import urllib.parse
2a1325fd 4
5from .common import InfoExtractor
c6641823 6
2a1325fd 7
8class YnetIE(InfoExtractor):
5886b38d 9 _VALID_URL = r'https?://(?:.+?\.)?ynet\.co\.il/(?:.+?/)?0,7340,(?P<id>L(?:-[0-9]+)+),00\.html'
c6641823
S
10 _TESTS = [
11 {
12 'url': 'http://hot.ynet.co.il/home/0,7340,L-11659-99244,00.html',
c6641823
S
13 'info_dict': {
14 'id': 'L-11659-99244',
15 'ext': 'flv',
16 'title': 'איש לא יודע מאיפה באנו',
ec85ded8 17 'thumbnail': r're:^https?://.*\.jpg',
c6641823
S
18 }
19 }, {
20 'url': 'http://hot.ynet.co.il/home/0,7340,L-8859-84418,00.html',
c6641823
S
21 'info_dict': {
22 'id': 'L-8859-84418',
23 'ext': 'flv',
24 'title': "צפו: הנשיקה הלוהטת של תורגי' ויוליה פלוטקין",
ec85ded8 25 'thumbnail': r're:^https?://.*\.jpg',
c6641823 26 }
2a1325fd 27 }
c6641823 28 ]
2a1325fd 29
30 def _real_extract(self, url):
dbe3043c 31 video_id = self._match_id(url)
c6641823 32 webpage = self._download_webpage(url, video_id)
2a1325fd 33
ac668111 34 content = urllib.parse.unquote_plus(self._og_search_video_url(webpage))
c6641823
S
35 config = json.loads(self._search_regex(r'config=({.+?})$', content, 'video config'))
36 f4m_url = config['clip']['url']
37 title = self._og_search_title(webpage)
38 m = re.search(r'ynet - HOT -- (["\']+)(?P<title>.+?)\1', title)
39 if m:
40 title = m.group('title')
19dbaeec 41 formats = self._extract_f4m_formats(f4m_url, video_id)
2a1325fd 42
43 return {
c6641823 44 'id': video_id,
2a1325fd 45 'title': title,
19dbaeec 46 'formats': formats,
2a1325fd 47 'thumbnail': self._og_search_thumbnail(webpage),
5f6a1245 48 }