]>
Commit | Line | Data |
---|---|---|
db40364b MTP |
1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
55cde6ef | 3 | |
db40364b | 4 | from .common import InfoExtractor |
db40364b MTP |
5 | |
6 | ||
7 | class Varzesh3IE(InfoExtractor): | |
55cde6ef S |
8 | _VALID_URL = r'https?://(?:www\.)?video\.varzesh3\.com/(?:[^/]+/)+(?P<id>[^/]+)/?' |
9 | _TEST = { | |
db40364b MTP |
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': { | |
db40364b MTP |
13 | 'id': '76337', |
14 | 'ext': 'mp4', | |
8896b614 | 15 | 'title': '۵ واکنش برتر دروازهبانان؛هفته ۲۶ بوندسلیگا', |
2315fb5e | 16 | 'description': 'فصل ۲۰۱۵-۲۰۱۴', |
55cde6ef | 17 | 'thumbnail': 're:^https?://.*\.jpg$', |
db40364b | 18 | } |
a7fce980 | 19 | } |
db40364b MTP |
20 | |
21 | def _real_extract(self, url): | |
55cde6ef S |
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') | |
db40364b | 28 | |
55cde6ef S |
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) | |
db40364b | 34 | |
55cde6ef S |
35 | video_id = self._search_regex( |
36 | r"<link[^>]+rel='(?:canonical|shortlink)'[^>]+href='/\?p=([^']+)'", | |
37 | webpage, display_id, default=display_id) | |
db40364b MTP |
38 | |
39 | return { | |
55cde6ef S |
40 | 'url': video_url, |
41 | 'id': video_id, | |
db40364b | 42 | 'title': title, |
db40364b MTP |
43 | 'description': description, |
44 | 'thumbnail': thumbnail, | |
45 | } |