]>
Commit | Line | Data |
---|---|---|
2a1325fd | 1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
4 | import re | |
2a1325fd | 5 | import json |
6 | ||
7 | from .common import InfoExtractor | |
c6641823 S |
8 | from ..utils import compat_urllib_parse |
9 | ||
2a1325fd | 10 | |
11 | class YnetIE(InfoExtractor): | |
a89435a7 | 12 | _VALID_URL = r'http://(?:.+?\.)?ynet\.co\.il/(?:.+?/)?0,7340,(?P<id>L(?:-[0-9]+)+),00\.html' |
c6641823 S |
13 | _TESTS = [ |
14 | { | |
15 | 'url': 'http://hot.ynet.co.il/home/0,7340,L-11659-99244,00.html', | |
16 | 'md5': '002b44ee2f33d50363a1c153bed524cf', | |
17 | 'info_dict': { | |
18 | 'id': 'L-11659-99244', | |
19 | 'ext': 'flv', | |
20 | 'title': 'איש לא יודע מאיפה באנו', | |
21 | 'thumbnail': 're:^https?://.*\.jpg', | |
22 | } | |
23 | }, { | |
24 | 'url': 'http://hot.ynet.co.il/home/0,7340,L-8859-84418,00.html', | |
25 | 'md5': '6455046ae1b48cf7e2b7cae285e53a16', | |
26 | 'info_dict': { | |
27 | 'id': 'L-8859-84418', | |
28 | 'ext': 'flv', | |
29 | 'title': "צפו: הנשיקה הלוהטת של תורגי' ויוליה פלוטקין", | |
30 | 'thumbnail': 're:^https?://.*\.jpg', | |
31 | } | |
2a1325fd | 32 | } |
c6641823 | 33 | ] |
2a1325fd | 34 | |
35 | def _real_extract(self, url): | |
36 | mobj = re.match(self._VALID_URL, url) | |
c6641823 | 37 | video_id = mobj.group('id') |
2a1325fd | 38 | |
c6641823 | 39 | webpage = self._download_webpage(url, video_id) |
2a1325fd | 40 | |
c6641823 S |
41 | content = compat_urllib_parse.unquote_plus(self._og_search_video_url(webpage)) |
42 | config = json.loads(self._search_regex(r'config=({.+?})$', content, 'video config')) | |
43 | f4m_url = config['clip']['url'] | |
44 | title = self._og_search_title(webpage) | |
45 | m = re.search(r'ynet - HOT -- (["\']+)(?P<title>.+?)\1', title) | |
46 | if m: | |
47 | title = m.group('title') | |
2a1325fd | 48 | |
49 | return { | |
c6641823 | 50 | 'id': video_id, |
2a1325fd | 51 | 'title': title, |
c6641823 | 52 | 'formats': self._extract_f4m_formats(f4m_url, video_id), |
2a1325fd | 53 | 'thumbnail': self._og_search_thumbnail(webpage), |
c6641823 | 54 | } |