]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ro220.py
4678f62dfadba9968ff363a919471c869eb35c71
[youtubedl] / youtube_dl / extractor / ro220.py
1 from __future__ import unicode_literals
2
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 = {
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",
21 "description": "Iata-ne reveniti dupa o binemeritata vacanta. Va astept si pe Facebook cu pareri si comentarii.",
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="([^"]+)"',
32 webpage, 'flashVars')
33 flashVars = compat_parse_qs(flashVars_str)
34
35 return {
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 }