]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/ynet.py
[extractor/FranceCulture] Fix extractor (#3874)
[yt-dlp.git] / yt_dlp / extractor / ynet.py
CommitLineData
2a1325fd 1import re
2a1325fd 2import json
3
4from .common import InfoExtractor
db6c50f1 5from ..compat import compat_urllib_parse_unquote_plus
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
db6c50f1 34 content = compat_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
S
41 formats = self._extract_f4m_formats(f4m_url, video_id)
42 self._sort_formats(formats)
2a1325fd 43
44 return {
c6641823 45 'id': video_id,
2a1325fd 46 'title': title,
19dbaeec 47 'formats': formats,
2a1325fd 48 'thumbnail': self._og_search_thumbnail(webpage),
5f6a1245 49 }