aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/yourupload.py
diff options
context:
space:
mode:
authorNaglis Jonaitis <njonaitis@gmail.com>2014-09-21 15:13:35 +0300
committerNaglis Jonaitis <njonaitis@gmail.com>2014-09-21 15:13:35 +0300
commitb28c8403b2c1ef51f04520e8116176b1fee12dcb (patch)
tree74f7096c9d059ffc16b47761761f1d61ce11630f /youtube_dl/extractor/yourupload.py
parent7bd4b4229a126a9f47035beec8a13eff08804850 (diff)
[yourupload] Add new extractor. Fixes #3085
Diffstat (limited to 'youtube_dl/extractor/yourupload.py')
-rw-r--r--youtube_dl/extractor/yourupload.py58
1 files changed, 58 insertions, 0 deletions
diff --git a/youtube_dl/extractor/yourupload.py b/youtube_dl/extractor/yourupload.py
new file mode 100644
index 000000000..40fc4165f
--- /dev/null
+++ b/youtube_dl/extractor/yourupload.py
@@ -0,0 +1,58 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+
+
+class YourUploadIE(InfoExtractor):
+ _VALID_URL = r'''(?x)https?://(?:www\.)?
+ (?:yourupload\.com/watch|
+ embed\.yourupload\.com|
+ embed\.yucache\.net
+ )/(?P<id>[A-Za-z0-9]+)
+ '''
+ _TESTS = [
+ {
+ 'url': 'http://yourupload.com/watch/14i14h',
+ 'md5': 'bf5c2f95c4c917536e80936af7bc51e1',
+ 'info_dict': {
+ 'id': '14i14h',
+ 'ext': 'mp4',
+ 'title': 'BigBuckBunny_320x180.mp4',
+ 'thumbnail': 're:^https?://.*\.jpe?g',
+ }
+ },
+ {
+ 'url': 'http://embed.yourupload.com/14i14h',
+ 'only_matching': True,
+ },
+ {
+ 'url': 'http://embed.yucache.net/14i14h?client_file_id=803349',
+ 'only_matching': True,
+ },
+ ]
+
+ def _real_extract(self, url):
+ mobj = re.match(self._VALID_URL, url)
+ video_id = mobj.group('id')
+
+ url = 'http://embed.yucache.net/{0:}'.format(video_id)
+ webpage = self._download_webpage(url, video_id)
+
+ title = self._og_search_title(webpage)
+ thumbnail = self._og_search_thumbnail(webpage)
+ url = self._og_search_video_url(webpage)
+
+ formats = [{
+ 'format_id': 'sd',
+ 'url': url,
+ }]
+
+ return {
+ 'id': video_id,
+ 'title': title,
+ 'formats': formats,
+ 'thumbnail': thumbnail,
+ }