2 from __future__ import unicode_literals
6 from .common import InfoExtractor
16 class ZapiksIE(InfoExtractor):
17 _VALID_URL = r'https?://(?:www\.)?zapiks\.fr/(?:(?P<display_id>.+?)\.html|index\.php\?.*\bmedia_id=(?P<id>\d+))'
20 'url': 'http://www.zapiks.fr/ep2s3-bon-appetit-eh-be-viva.html',
21 'md5': 'aeb3c473b2d564b2d46d664d28d5f050',
25 'title': 'EP2S3 - Bon Appétit - Eh bé viva les pyrénées con!',
26 'description': 'md5:7054d6f6f620c6519be1fe710d4da847',
27 'thumbnail': 're:^https?://.*\.jpg$',
29 'timestamp': 1359044972,
30 'upload_date': '20130124',
36 'url': 'http://www.zapiks.fr/index.php?action=playerIframe&media_id=118046&width=640&height=360&autoStart=false&language=fr',
37 'only_matching': True,
41 def _real_extract(self, url):
42 mobj = re.match(self._VALID_URL, url)
43 video_id = mobj.group('id')
44 display_id = mobj.group('display_id') or video_id
46 webpage = self._download_webpage(url, display_id)
49 video_id = self._search_regex(
50 r'data-media-id="(\d+)"', webpage, 'video id')
52 playlist = self._download_xml(
53 'http://www.zapiks.fr/view/index.php?action=playlist&media_id=%s&lang=en' % video_id,
57 'jwplayer': 'http://rss.jwpcdn.com/'
61 return xpath_with_ns(path, NS_MAP)
63 item = playlist.find('./channel/item')
65 title = xpath_text(item, 'title', 'title') or self._og_search_title(webpage)
66 description = self._og_search_description(webpage, default=None)
67 thumbnail = xpath_text(
68 item, ns('./jwplayer:image'), 'thumbnail') or self._og_search_thumbnail(webpage, default=None)
69 duration = parse_duration(self._html_search_meta(
70 'duration', webpage, 'duration', default=None))
71 timestamp = parse_iso8601(self._html_search_meta(
72 'uploadDate', webpage, 'upload date', default=None), ' ')
74 view_count = int_or_none(self._search_regex(
75 r'UserPlays:(\d+)', webpage, 'view count', default=None))
76 comment_count = int_or_none(self._search_regex(
77 r'UserComments:(\d+)', webpage, 'comment count', default=None))
80 for source in item.findall(ns('./jwplayer:source')):
81 format_id = source.attrib['label']
83 'url': source.attrib['file'],
84 'format_id': format_id,
86 m = re.search(r'^(?P<height>\d+)[pP]', format_id)
88 f['height'] = int(m.group('height'))
90 self._sort_formats(formats)
95 'description': description,
96 'thumbnail': thumbnail,
98 'timestamp': timestamp,
99 'view_count': view_count,
100 'comment_count': comment_count,