]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/xboxclips.py
Add more information to the Changelog.
[youtubedl] / youtube_dl / extractor / xboxclips.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..utils import (
6 int_or_none,
7 parse_filesize,
8 unified_strdate,
9 )
10
11
12 class XboxClipsIE(InfoExtractor):
13 _VALID_URL = r'https?://(?:www\.)?xboxclips\.com/(?:video\.php\?.*vid=|[^/]+/)(?P<id>[\w-]{36})'
14 _TEST = {
15 'url': 'http://xboxclips.com/video.php?uid=2533274823424419&gamertag=Iabdulelah&vid=074a69a9-5faf-46aa-b93b-9909c1720325',
16 'md5': 'fbe1ec805e920aeb8eced3c3e657df5d',
17 'info_dict': {
18 'id': '074a69a9-5faf-46aa-b93b-9909c1720325',
19 'ext': 'mp4',
20 'title': 'Iabdulelah playing Titanfall',
21 'filesize_approx': 26800000,
22 'upload_date': '20140807',
23 'duration': 56,
24 }
25 }
26
27 def _real_extract(self, url):
28 video_id = self._match_id(url)
29
30 webpage = self._download_webpage(url, video_id)
31
32 video_url = self._html_search_regex(
33 r'>(?:Link|Download): <a[^>]+href="([^"]+)"', webpage, 'video URL')
34 title = self._html_search_regex(
35 r'<title>XboxClips \| ([^<]+)</title>', webpage, 'title')
36 upload_date = unified_strdate(self._html_search_regex(
37 r'>Recorded: ([^<]+)<', webpage, 'upload date', fatal=False))
38 filesize = parse_filesize(self._html_search_regex(
39 r'>Size: ([^<]+)<', webpage, 'file size', fatal=False))
40 duration = int_or_none(self._html_search_regex(
41 r'>Duration: (\d+) Seconds<', webpage, 'duration', fatal=False))
42 view_count = int_or_none(self._html_search_regex(
43 r'>Views: (\d+)<', webpage, 'view count', fatal=False))
44
45 return {
46 'id': video_id,
47 'url': video_url,
48 'title': title,
49 'upload_date': upload_date,
50 'filesize_approx': filesize,
51 'duration': duration,
52 'view_count': view_count,
53 }