2 from __future__ import unicode_literals
3 from .common import InfoExtractor
10 class Varzesh3IE(InfoExtractor):
11 _VALID_URL = r'(?P<url>(https?://(?:www\.)?video\.varzesh3\.com)/(?P<id>.+))'
14 'url': 'http://video.varzesh3.com/video/%D8%AF%D8%A7%D9%86%D9%85%D8%A7%D8%B1%DA%A9-3-2-%D8%A2%D9%85%D8%B1%DB%8C%DA%A9%D8%A7/',
15 'md5': 'c4b850780df9374b078463c5cf6b3318',
17 'url': 'http://dl1.video.varzesh3.com/video/clip94/1/international/friendly/usa_2_3_danmark.mp4',
20 'title': u'دانمارک ۳-۲ آمریکا (گلهای بازی)',
21 'thumbnail': 'http://video.varzesh3.com/wp-content/uploads/250315_usa_danmark_site.jpg',
22 'description': u'بازی دوستانه ۲۰۱۵',
27 '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/',
28 'md5': '2a933874cb7dce4366075281eb49e855',
30 'url': 'http://dl1.video.varzesh3.com/video/clip94/1/video/namayeshi/saves_week26.mp4',
33 'title': u'۵ واکنش برتر دروازهبانان؛هفته ۲۶ بوندسلیگا',
34 'thumbnail': 'http://video.varzesh3.com/wp-content/uploads/230315_saves_week26.jpg',
35 'description': u'فصل ۲۰۱۵-۲۰۱۴',
40 def _real_extract(self, url):
41 video_id = self._match_id(url)
42 webpage = self._download_webpage(url, video_id)
44 if not 'shortlink' in webpage:
45 raise ExtractorError('URL has no videos or there is a problem.')
47 title = self._html_search_regex(r'meta[^>]+property="og:title"[^>]+content="([^"]+)"', webpage, 'title')
48 video_link = self._html_search_regex(r'source[^>]+src="([^"]+)"', webpage, 'video_link')
49 vid_id = self._html_search_regex(r"link[^>]+rel='canonical'[^>]+href='\/\?p=([^']+)'\/>", webpage, 'vid_id')
51 description = self._html_search_regex(r'<div class="matn">(.*?)</div>', webpage, 'description', flags=re.DOTALL)
54 thumbnail = self._html_search_regex(r'link[^>]+rel="image_src"[^>]+href="([^"]+)"', webpage, 'thumbnail')
60 'ext': video_link.split(".")[-1],
61 'description': description,
62 'thumbnail': thumbnail,