about summary refs log tree commit diff
path: root/youtube_dl/extractor/xboxclips.py
blob: 499702d0defd7f4a6397a5a6d5e160bbf93014f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# encoding: utf-8
import re

from .common import InfoExtractor

class XboxClipsIE(InfoExtractor):
    _VALID_URL = r'^https?://(www\.)?xboxclips\.com/video.php\?.*vid=(?P<id>[\w-]*)'
    _TEST = {
            'url': 'https://xboxclips.com/video.php?uid=2533274823424419&gamertag=Iabdulelah&vid=074a69a9-5faf-46aa-b93b-9909c1720325',
            'md5': 'fbe1ec805e920aeb8eced3c3e657df5d',
            'info_dict': {
                'id': '074a69a9-5faf-46aa-b93b-9909c1720325',
                'ext': 'mp4',
                'title': 'Iabdulelah playing Upload Studio',
                }
            } 

    def _real_extract(self, url):
        mobj = re.match(self._VALID_URL, url)
        video_id = mobj.group('id')

        webpage = self._download_webpage(url, video_id)
        video_url = self._search_regex(r'Link.*?"(.*?)"',
                webpage, 'video URL')

        video_title = self._html_search_regex(r'<title>.*?\|(.*?)<',
                webpage, 'title')

        return {
                'id': video_id,
                'url': video_url,
                'title': video_title,
                'ext': 'mp4',
                }