aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2013-07-08 22:21:06 +0200
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2013-07-08 22:21:06 +0200
commit16ea58cbda0b27d7b43d156092a518a55c69aac4 (patch)
tree7ab16dd42371f6de18859af396cb69b4087d393e /youtube_dl
parent99e350d902d07d3cd9a800bf7c58b76c12ca6e6e (diff)
parent13e06d298c6003e6afd3abaf81f26df0a70af3d9 (diff)
Merge pull request #1009 from yasoob/master
Added an IE and test for dotsub.com videos. ( closes #1008 )
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/__init__.py2
-rw-r--r--youtube_dl/extractor/dotsub.py42
2 files changed, 43 insertions, 1 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py
index 9aaa7ca9b..934419c43 100644
--- a/youtube_dl/extractor/__init__.py
+++ b/youtube_dl/extractor/__init__.py
@@ -1,4 +1,3 @@
-
from .archiveorg import ArchiveOrgIE
from .ard import ARDIE
from .arte import ArteTvIE
@@ -12,6 +11,7 @@ from .comedycentral import ComedyCentralIE
from .cspan import CSpanIE
from .dailymotion import DailymotionIE
from .depositfiles import DepositFilesIE
+from .dotsub import DotsubIE
from .dreisat import DreiSatIE
from .eighttracks import EightTracksIE
from .escapist import EscapistIE
diff --git a/youtube_dl/extractor/dotsub.py b/youtube_dl/extractor/dotsub.py
new file mode 100644
index 000000000..2afeaba07
--- /dev/null
+++ b/youtube_dl/extractor/dotsub.py
@@ -0,0 +1,42 @@
+import re
+import json
+from .common import InfoExtractor
+
+
+class DotsubIE(InfoExtractor):
+ _VALID_URL = r'(?:http://)?(?:www\.)?dotsub\.com/view/([^/]+)'
+ _TEST = {
+ u'url': u'http://dotsub.com/view/aed3b8b2-1889-4df5-ae63-ad85f5572f27',
+ u'file': u'aed3b8b2-1889-4df5-ae63-ad85f5572f27.flv',
+ u'md5': u'0914d4d69605090f623b7ac329fea66e',
+ u'info_dict': {
+ u"title": u"Pyramids of Waste (2010), AKA The Lightbulb Conspiracy - Planned obsolescence documentary",
+ u"uploader": u"4v4l0n42",
+ u'description': u'Pyramids of Waste (2010) also known as "The lightbulb conspiracy" is a documentary about how our economic system based on consumerism and planned obsolescence is breaking our planet down.\r\n\r\nSolutions to this can be found at:\r\nhttp://robotswillstealyourjob.com\r\nhttp://www.federicopistono.org\r\n\r\nhttp://opensourceecology.org\r\nhttp://thezeitgeistmovement.com',
+ u'thumbnail': u'http://dotsub.com/media/aed3b8b2-1889-4df5-ae63-ad85f5572f27/p'
+ }
+ }
+
+ def _real_extract(self, url):
+ mobj = re.match(self._VALID_URL, url)
+ video_id = mobj.group(1)
+ info_url = "https://dotsub.com/api/media/%s/metadata" %(video_id)
+ webpage = self._download_webpage(info_url, video_id)
+ info = json.loads(webpage)
+ video_url = info['mediaURI']
+ uploader = info['user']
+ description = info['description']
+ view_count = info['numberOfViews']
+ title = info['title']
+ thumbnail_url = info['screenshotURI']
+ ext = 'flv'
+ return [{
+ 'id': video_id,
+ 'url': video_url,
+ 'ext': ext,
+ 'title': title,
+ 'thumbnail': thumbnail_url,
+ 'description': description,
+ 'uploader': uploader,
+ 'view_count': view_count,
+ }]