]>
Commit | Line | Data |
---|---|---|
a7454758 B |
1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
4 | from .common import InfoExtractor | |
9700cd90 | 5 | from ..utils import remove_start |
a7454758 B |
6 | |
7 | ||
8 | class Ir90TvIE(InfoExtractor): | |
9 | _VALID_URL = r'https?://(?:www\.)?90tv\.ir/video/(?P<id>[0-9]+)/.*' | |
eab7faa0 | 10 | _TESTS = [{ |
a7454758 B |
11 | 'url': 'http://90tv.ir/video/95719/%D8%B4%D8%A7%DB%8C%D8%B9%D8%A7%D8%AA-%D9%86%D9%82%D9%84-%D9%88-%D8%A7%D9%86%D8%AA%D9%82%D8%A7%D9%84%D8%A7%D8%AA-%D9%85%D9%87%D9%85-%D9%81%D9%88%D8%AA%D8%A8%D8%A7%D9%84-%D8%A7%D8%B1%D9%88%D9%BE%D8%A7-940218', |
12 | 'md5': '411dbd94891381960cb9e13daa47a869', | |
13 | 'info_dict': { | |
14 | 'id': '95719', | |
15 | 'ext': 'mp4', | |
16 | 'title': 'شایعات نقل و انتقالات مهم فوتبال اروپا 94/02/18', | |
17 | 'thumbnail': 're:^https?://.*\.jpg$', | |
18 | } | |
eab7faa0 YCH |
19 | }, { |
20 | 'url': 'http://www.90tv.ir/video/95719/%D8%B4%D8%A7%DB%8C%D8%B9%D8%A7%D8%AA-%D9%86%D9%82%D9%84-%D9%88-%D8%A7%D9%86%D8%AA%D9%82%D8%A7%D9%84%D8%A7%D8%AA-%D9%85%D9%87%D9%85-%D9%81%D9%88%D8%AA%D8%A8%D8%A7%D9%84-%D8%A7%D8%B1%D9%88%D9%BE%D8%A7-940218', | |
21 | 'only_matching': True, | |
22 | }] | |
a7454758 B |
23 | |
24 | def _real_extract(self, url): | |
25 | video_id = self._match_id(url) | |
26 | webpage = self._download_webpage(url, video_id) | |
27 | ||
9700cd90 YCH |
28 | title = remove_start(self._html_search_regex( |
29 | r'<title>([^<]+)</title>', webpage, 'title'), '90tv.ir :: ') | |
a7454758 B |
30 | |
31 | video_url = self._search_regex( | |
32 | r'<source[^>]+src="([^"]+)"', webpage, 'video url') | |
33 | ||
34 | thumbnail = self._search_regex(r'poster="([^"]+)"', webpage, 'thumbnail url') | |
a7454758 B |
35 | |
36 | return { | |
37 | 'url': video_url, | |
38 | 'id': video_id, | |
39 | 'title': title, | |
75236473 YCH |
40 | 'video_url': video_url, |
41 | 'thumbnail': thumbnail, | |
54b31d14 | 42 | } |