]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/yourupload.py
Imported Upstream version 2015.06.04.1
[youtubedl] / youtube_dl / extractor / yourupload.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5
6
7 class YourUploadIE(InfoExtractor):
8 _VALID_URL = r'''(?x)https?://(?:www\.)?
9 (?:yourupload\.com/watch|
10 embed\.yourupload\.com|
11 embed\.yucache\.net
12 )/(?P<id>[A-Za-z0-9]+)
13 '''
14 _TESTS = [
15 {
16 'url': 'http://yourupload.com/watch/14i14h',
17 'md5': '5e2c63385454c557f97c4c4131a393cd',
18 'info_dict': {
19 'id': '14i14h',
20 'ext': 'mp4',
21 'title': 'BigBuckBunny_320x180.mp4',
22 'thumbnail': 're:^https?://.*\.jpe?g',
23 }
24 },
25 {
26 'url': 'http://embed.yourupload.com/14i14h',
27 'only_matching': True,
28 },
29 {
30 'url': 'http://embed.yucache.net/14i14h?client_file_id=803349',
31 'only_matching': True,
32 },
33 ]
34
35 def _real_extract(self, url):
36 video_id = self._match_id(url)
37
38 embed_url = 'http://embed.yucache.net/{0:}'.format(video_id)
39 webpage = self._download_webpage(embed_url, video_id)
40
41 title = self._og_search_title(webpage)
42 video_url = self._og_search_video_url(webpage)
43 thumbnail = self._og_search_thumbnail(webpage, default=None)
44
45 return {
46 'id': video_id,
47 'title': title,
48 'url': video_url,
49 'thumbnail': thumbnail,
50 'http_headers': {
51 'Referer': embed_url,
52 },
53 }