mirror of https://github.com/yt-dlp/yt-dlp
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.7 KiB
Python
50 lines
1.7 KiB
Python
10 years ago
|
import re
|
||
|
import json
|
||
|
|
||
|
from .common import InfoExtractor
|
||
9 years ago
|
from ..compat import compat_urllib_parse_unquote_plus
|
||
10 years ago
|
|
||
10 years ago
|
|
||
|
class YnetIE(InfoExtractor):
|
||
9 years ago
|
_VALID_URL = r'https?://(?:.+?\.)?ynet\.co\.il/(?:.+?/)?0,7340,(?P<id>L(?:-[0-9]+)+),00\.html'
|
||
10 years ago
|
_TESTS = [
|
||
|
{
|
||
|
'url': 'http://hot.ynet.co.il/home/0,7340,L-11659-99244,00.html',
|
||
|
'info_dict': {
|
||
|
'id': 'L-11659-99244',
|
||
|
'ext': 'flv',
|
||
|
'title': 'איש לא יודע מאיפה באנו',
|
||
8 years ago
|
'thumbnail': r're:^https?://.*\.jpg',
|
||
10 years ago
|
}
|
||
|
}, {
|
||
|
'url': 'http://hot.ynet.co.il/home/0,7340,L-8859-84418,00.html',
|
||
|
'info_dict': {
|
||
|
'id': 'L-8859-84418',
|
||
|
'ext': 'flv',
|
||
|
'title': "צפו: הנשיקה הלוהטת של תורגי' ויוליה פלוטקין",
|
||
8 years ago
|
'thumbnail': r're:^https?://.*\.jpg',
|
||
10 years ago
|
}
|
||
10 years ago
|
}
|
||
10 years ago
|
]
|
||
10 years ago
|
|
||
|
def _real_extract(self, url):
|
||
10 years ago
|
video_id = self._match_id(url)
|
||
10 years ago
|
webpage = self._download_webpage(url, video_id)
|
||
10 years ago
|
|
||
9 years ago
|
content = compat_urllib_parse_unquote_plus(self._og_search_video_url(webpage))
|
||
10 years ago
|
config = json.loads(self._search_regex(r'config=({.+?})$', content, 'video config'))
|
||
|
f4m_url = config['clip']['url']
|
||
|
title = self._og_search_title(webpage)
|
||
|
m = re.search(r'ynet - HOT -- (["\']+)(?P<title>.+?)\1', title)
|
||
|
if m:
|
||
|
title = m.group('title')
|
||
9 years ago
|
formats = self._extract_f4m_formats(f4m_url, video_id)
|
||
|
self._sort_formats(formats)
|
||
10 years ago
|
|
||
|
return {
|
||
10 years ago
|
'id': video_id,
|
||
10 years ago
|
'title': title,
|
||
9 years ago
|
'formats': formats,
|
||
10 years ago
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||
10 years ago
|
}
|