]>
Commit | Line | Data |
---|---|---|
2ddfd26f | 1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
4 | from .common import InfoExtractor | |
5 | ||
6 | ||
7 | class ZippCastIE(InfoExtractor): | |
8 | _VALID_URL = r'https?://(?:www\.)?zippcast\.com/video/(?P<id>[0-9a-zA-Z]+)' | |
9 | _TESTS = [{ | |
10 | 'url': 'http://www.zippcast.com/video/c9cfd5c7e44dbc29c81', | |
11 | 'md5': 'f2aea8659962d9155031aaeac53f7c54', | |
12 | 'info_dict': { | |
13 | 'id': 'c9cfd5c7e44dbc29c81', | |
14 | 'ext': 'mp4', | |
15 | 'title': '[Vinesauce] Vinny - Digital Space Traveler', | |
16 | 'thumbnail': 're:^https?://.*\.jpg$', | |
17 | 'uploader': 'vinesauce', | |
18 | 'description': 'Muted on youtube, but now uploaded in it\'s original form.', | |
19 | 'categories': ['Entertainment'], | |
20 | 'view_count': int, | |
21 | }, | |
22 | }, { | |
23 | 'url': 'http://www.zippcast.com/video/b79c0a233e9c6581775', | |
24 | 'md5': 'b8631f0cc48ed15387f9179988d0c97c', | |
25 | 'info_dict': { | |
26 | 'id': 'b79c0a233e9c6581775', | |
27 | 'ext': 'mp4', | |
28 | 'title': 'Battlefield Hardline Trailer', | |
29 | 'thumbnail': 're:^https?://.*\.jpg$', | |
30 | 'uploader': 'IGXGaming', | |
31 | 'description': 'Battlefield Hardline Trailer', | |
32 | 'categories': ['Gaming'], | |
33 | 'view_count': int, | |
34 | }, | |
35 | }] | |
36 | ||
37 | def _real_extract(self, url): | |
38 | video_id = self._match_id(url) | |
39 | webpage = self._download_webpage(url, video_id) | |
40 | ||
41 | title = self._html_search_regex(r'title="(.+?)"', webpage, 'title') | |
42 | uploader = self._html_search_regex(r'http://www.zippcast.com/profile/(.+?)">', webpage, 'uploader') | |
43 | url = self._html_search_regex(r'<source src="(.+?)" type="', webpage, 'url') | |
44 | description = self._html_search_regex(r'<span class="vdescr".+>(.+?)</span>', webpage, 'description') | |
45 | thumbnail = self._html_search_regex(r'poster="(.+?)" controls>', webpage, 'thumbnail') | |
46 | categories = self._html_search_regex(r'<a href="http://www.zippcast.com/categories/(.+?)"', webpage, 'categories') | |
47 | view_count = self._html_search_regex(r'<td align="right"><h3>(.+?) views!', webpage, 'view_count') | |
48 | ||
49 | return { | |
50 | 'id': video_id, | |
51 | 'title': title, | |
52 | 'url': url, | |
53 | 'description': description, | |
54 | 'uploader': uploader, | |
55 | 'thumbnail': thumbnail, | |
56 | 'categories': [categories], | |
57 | 'view_count': int(view_count.replace(',', '')), | |
58 | } |