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