mirror of https://github.com/blackjack4494/yt-dlc
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.9 KiB
Python
54 lines
1.9 KiB
Python
8 years ago
|
# coding: utf-8
|
||
11 years ago
|
from __future__ import unicode_literals
|
||
|
|
||
11 years ago
|
from .common import InfoExtractor
|
||
11 years ago
|
from ..utils import (
|
||
|
int_or_none,
|
||
10 years ago
|
parse_filesize,
|
||
|
unified_strdate,
|
||
11 years ago
|
)
|
||
|
|
||
11 years ago
|
|
||
|
class XboxClipsIE(InfoExtractor):
|
||
10 years ago
|
_VALID_URL = r'https?://(?:www\.)?xboxclips\.com/(?:video\.php\?.*vid=|[^/]+/)(?P<id>[\w-]{36})'
|
||
11 years ago
|
_TEST = {
|
||
9 years ago
|
'url': 'http://xboxclips.com/video.php?uid=2533274823424419&gamertag=Iabdulelah&vid=074a69a9-5faf-46aa-b93b-9909c1720325',
|
||
11 years ago
|
'md5': 'fbe1ec805e920aeb8eced3c3e657df5d',
|
||
|
'info_dict': {
|
||
|
'id': '074a69a9-5faf-46aa-b93b-9909c1720325',
|
||
|
'ext': 'mp4',
|
||
10 years ago
|
'title': 'Iabdulelah playing Titanfall',
|
||
|
'filesize_approx': 26800000,
|
||
11 years ago
|
'upload_date': '20140807',
|
||
|
'duration': 56,
|
||
|
}
|
||
|
}
|
||
11 years ago
|
|
||
|
def _real_extract(self, url):
|
||
10 years ago
|
video_id = self._match_id(url)
|
||
11 years ago
|
|
||
|
webpage = self._download_webpage(url, video_id)
|
||
|
|
||
11 years ago
|
video_url = self._html_search_regex(
|
||
10 years ago
|
r'>(?:Link|Download): <a[^>]+href="([^"]+)"', webpage, 'video URL')
|
||
11 years ago
|
title = self._html_search_regex(
|
||
|
r'<title>XboxClips \| ([^<]+)</title>', webpage, 'title')
|
||
10 years ago
|
upload_date = unified_strdate(self._html_search_regex(
|
||
11 years ago
|
r'>Recorded: ([^<]+)<', webpage, 'upload date', fatal=False))
|
||
10 years ago
|
filesize = parse_filesize(self._html_search_regex(
|
||
|
r'>Size: ([^<]+)<', webpage, 'file size', fatal=False))
|
||
11 years ago
|
duration = int_or_none(self._html_search_regex(
|
||
|
r'>Duration: (\d+) Seconds<', webpage, 'duration', fatal=False))
|
||
|
view_count = int_or_none(self._html_search_regex(
|
||
|
r'>Views: (\d+)<', webpage, 'view count', fatal=False))
|
||
11 years ago
|
|
||
|
return {
|
||
11 years ago
|
'id': video_id,
|
||
|
'url': video_url,
|
||
|
'title': title,
|
||
10 years ago
|
'upload_date': upload_date,
|
||
11 years ago
|
'filesize_approx': filesize,
|
||
|
'duration': duration,
|
||
|
'view_count': view_count,
|
||
|
}
|