45 lines
1.7 KiB
Python
Raw Normal View History

2019-12-13 01:09:36 +02:00
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
2019-12-13 04:04:15 +02:00
2019-12-13 01:09:36 +02:00
class GamerDVRIE(InfoExtractor):
2019-12-13 04:04:15 +02:00
_VALID_URL = r'https?://(?:www\.)?gamerdvr\.com' +
'/gamer/\S+/video/(?P<id>\d+)'
2019-12-13 01:09:36 +02:00
_TEST = {
2019-12-13 03:30:03 +02:00
'url': 'https://gamerdvr.com/gamer/videogamer3/video/83193307',
2019-12-13 03:45:41 +02:00
'md5': 'f747c74fbc7617a70d8c071927623cde',
2019-12-13 01:09:36 +02:00
'info_dict': {
2019-12-13 03:30:03 +02:00
'id': '83193307',
2019-12-13 01:09:36 +02:00
'ext': 'mp4',
2019-12-13 04:04:15 +02:00
'title': "videogamer3's Xbox Call of Duty®: Modern Warfare® " +
"clip 83193307. Find your Xbox clips on GamerDVR.com",
'description': "videogamer3's Xbox Call of Duty®: Modern " +
"Warfare® clips and gameplay playing Call of Duty®: Modern " +
"Warfare®. All your Xbox clips and screenshots on GamerDVR.com. " +
"View, manage, and share easily!",
2019-12-13 03:45:41 +02:00
'uploader': 'videogamer3'
2019-12-13 01:09:36 +02:00
}
}
def _real_extract(self, url):
2019-12-13 03:30:03 +02:00
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
2019-12-13 04:04:15 +02:00
video_url = self._html_search_regex(
r"<source src=\"(\S+)\"", webpage, 'URL')
title = self._html_search_regex(
r'<title>(.+?)</title>', webpage, 'title')
description = self._html_search_regex(
r"<meta name=\"description\" content=([\"'])((?:\\\1|.)*?)\1",
webpage, 'description', group=2)
uploader = self._html_search_regex(
r"window\.gamertag = '(\S+)'", webpage, 'uploader')
2019-12-13 01:09:36 +02:00
return {
2019-12-13 03:30:03 +02:00
'id': video_id,
'title': title,
'description': description,
'uploader': uploader,
2019-12-13 04:04:15 +02:00
'url': video_url
}