]>
Commit | Line | Data |
---|---|---|
64d02399 | 1 | # encoding: utf-8 |
31bf2130 S |
2 | from __future__ import unicode_literals |
3 | ||
64d02399 | 4 | import re |
5 | ||
6 | from .common import InfoExtractor | |
31bf2130 S |
7 | from ..utils import ( |
8 | parse_iso8601, | |
9 | float_or_none, | |
10 | int_or_none, | |
11 | ) | |
12 | ||
64d02399 | 13 | |
14 | class XboxClipsIE(InfoExtractor): | |
31bf2130 | 15 | _VALID_URL = r'https?://(?:www\.)?xboxclips\.com/video\.php\?.*vid=(?P<id>[\w-]{36})' |
64d02399 | 16 | _TEST = { |
31bf2130 S |
17 | 'url': 'https://xboxclips.com/video.php?uid=2533274823424419&gamertag=Iabdulelah&vid=074a69a9-5faf-46aa-b93b-9909c1720325', |
18 | 'md5': 'fbe1ec805e920aeb8eced3c3e657df5d', | |
19 | 'info_dict': { | |
20 | 'id': '074a69a9-5faf-46aa-b93b-9909c1720325', | |
21 | 'ext': 'mp4', | |
22 | 'title': 'Iabdulelah playing Upload Studio', | |
23 | 'filesize_approx': 28101836.8, | |
24 | 'timestamp': 1407388500, | |
25 | 'upload_date': '20140807', | |
26 | 'duration': 56, | |
27 | } | |
28 | } | |
64d02399 | 29 | |
30 | def _real_extract(self, url): | |
31 | mobj = re.match(self._VALID_URL, url) | |
32 | video_id = mobj.group('id') | |
33 | ||
34 | webpage = self._download_webpage(url, video_id) | |
64d02399 | 35 | |
31bf2130 S |
36 | video_url = self._html_search_regex( |
37 | r'>Link: <a href="([^"]+)">', webpage, 'video URL') | |
38 | title = self._html_search_regex( | |
39 | r'<title>XboxClips \| ([^<]+)</title>', webpage, 'title') | |
40 | timestamp = parse_iso8601(self._html_search_regex( | |
41 | r'>Recorded: ([^<]+)<', webpage, 'upload date', fatal=False)) | |
42 | filesize = float_or_none(self._html_search_regex( | |
43 | r'>Size: ([\d\.]+)MB<', webpage, 'file size', fatal=False), invscale=1024 * 1024) | |
44 | duration = int_or_none(self._html_search_regex( | |
45 | r'>Duration: (\d+) Seconds<', webpage, 'duration', fatal=False)) | |
46 | view_count = int_or_none(self._html_search_regex( | |
47 | r'>Views: (\d+)<', webpage, 'view count', fatal=False)) | |
64d02399 | 48 | |
49 | return { | |
31bf2130 S |
50 | 'id': video_id, |
51 | 'url': video_url, | |
52 | 'title': title, | |
53 | 'timestamp': timestamp, | |
54 | 'filesize_approx': filesize, | |
55 | 'duration': duration, | |
56 | 'view_count': view_count, | |
57 | } |