]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/varzesh3.py
debian/control: Prefer mplayer to mplayer2 in Recommends.
[youtubedl] / youtube_dl / extractor / varzesh3.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5
6
7 class Varzesh3IE(InfoExtractor):
8 _VALID_URL = r'https?://(?:www\.)?video\.varzesh3\.com/(?:[^/]+/)+(?P<id>[^/]+)/?'
9 _TEST = {
10 'url': 'http://video.varzesh3.com/germany/bundesliga/5-%D9%88%D8%A7%DA%A9%D9%86%D8%B4-%D8%A8%D8%B1%D8%AA%D8%B1-%D8%AF%D8%B1%D9%88%D8%A7%D8%B2%D9%87%E2%80%8C%D8%A8%D8%A7%D9%86%D8%A7%D9%86%D8%9B%D9%87%D9%81%D8%AA%D9%87-26-%D8%A8%D9%88%D9%86%D8%AF%D8%B3/',
11 'md5': '2a933874cb7dce4366075281eb49e855',
12 'info_dict': {
13 'id': '76337',
14 'ext': 'mp4',
15 'title': '۵ واکنش برتر دروازه‌بانان؛هفته ۲۶ بوندسلیگا',
16 'description': 'فصل ۲۰۱۵-۲۰۱۴',
17 'thumbnail': 're:^https?://.*\.jpg$',
18 }
19 }
20
21 def _real_extract(self, url):
22 display_id = self._match_id(url)
23
24 webpage = self._download_webpage(url, display_id)
25
26 video_url = self._search_regex(
27 r'<source[^>]+src="([^"]+)"', webpage, 'video url')
28
29 title = self._og_search_title(webpage)
30 description = self._html_search_regex(
31 r'(?s)<div class="matn">(.+?)</div>',
32 webpage, 'description', fatal=False)
33 thumbnail = self._og_search_thumbnail(webpage)
34
35 video_id = self._search_regex(
36 r"<link[^>]+rel='(?:canonical|shortlink)'[^>]+href='/\?p=([^']+)'",
37 webpage, display_id, default=display_id)
38
39 return {
40 'url': video_url,
41 'id': video_id,
42 'title': title,
43 'description': description,
44 'thumbnail': thumbnail,
45 }