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