]>
Commit | Line | Data |
---|---|---|
7aed8375 JMF |
1 | from __future__ import unicode_literals |
2 | ||
9460db83 PH |
3 | import re |
4 | ||
5 | from .common import InfoExtractor | |
6 | from ..utils import ( | |
7 | clean_html, | |
8 | compat_parse_qs, | |
9 | ) | |
10 | ||
11 | ||
12 | class Ro220IE(InfoExtractor): | |
13 | IE_NAME = '220.ro' | |
14 | _VALID_URL = r'(?x)(?:https?://)?(?:www\.)?220\.ro/(?P<category>[^/]+)/(?P<shorttitle>[^/]+)/(?P<video_id>[^/]+)' | |
15 | _TEST = { | |
7aed8375 JMF |
16 | "url": "http://www.220.ro/sport/Luati-Le-Banii-Sez-4-Ep-1/LYV6doKo7f/", |
17 | 'file': 'LYV6doKo7f.mp4', | |
18 | 'md5': '03af18b73a07b4088753930db7a34add', | |
19 | 'info_dict': { | |
20 | "title": "Luati-le Banii sez 4 ep 1", | |
e09b8fcd | 21 | "description": "re:^Iata-ne reveniti dupa o binemeritata vacanta\. +Va astept si pe Facebook cu pareri si comentarii.$", |
9460db83 PH |
22 | } |
23 | } | |
24 | ||
25 | def _real_extract(self, url): | |
26 | mobj = re.match(self._VALID_URL, url) | |
27 | video_id = mobj.group('video_id') | |
28 | ||
29 | webpage = self._download_webpage(url, video_id) | |
30 | flashVars_str = self._search_regex( | |
31 | r'<param name="flashVars" value="([^"]+)"', | |
7aed8375 | 32 | webpage, 'flashVars') |
9460db83 PH |
33 | flashVars = compat_parse_qs(flashVars_str) |
34 | ||
7aed8375 | 35 | return { |
9460db83 PH |
36 | '_type': 'video', |
37 | 'id': video_id, | |
38 | 'ext': 'mp4', | |
39 | 'url': flashVars['videoURL'][0], | |
40 | 'title': flashVars['title'][0], | |
41 | 'description': clean_html(flashVars['desc'][0]), | |
42 | 'thumbnail': flashVars['preview'][0], | |
43 | } |