]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/dotsub.py
Update changelog
[youtubedl] / youtube_dl / extractor / dotsub.py
1 from __future__ import unicode_literals
2
3 import re
4 import time
5
6 from .common import InfoExtractor
7
8
9 class DotsubIE(InfoExtractor):
10 _VALID_URL = r'http://(?:www\.)?dotsub\.com/view/(?P<id>[^/]+)'
11 _TEST = {
12 'url': 'http://dotsub.com/view/aed3b8b2-1889-4df5-ae63-ad85f5572f27',
13 'md5': '0914d4d69605090f623b7ac329fea66e',
14 'info_dict': {
15 'id': 'aed3b8b2-1889-4df5-ae63-ad85f5572f27',
16 'ext': 'flv',
17 'title': 'Pyramids of Waste (2010), AKA The Lightbulb Conspiracy - Planned obsolescence documentary',
18 'uploader': '4v4l0n42',
19 'description': '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',
20 'thumbnail': 'http://dotsub.com/media/aed3b8b2-1889-4df5-ae63-ad85f5572f27/p',
21 'upload_date': '20101213',
22 }
23 }
24
25 def _real_extract(self, url):
26 mobj = re.match(self._VALID_URL, url)
27 video_id = mobj.group('id')
28 info_url = "https://dotsub.com/api/media/%s/metadata" % video_id
29 info = self._download_json(info_url, video_id)
30 date = time.gmtime(info['dateCreated']/1000) # The timestamp is in miliseconds
31
32 return {
33 'id': video_id,
34 'url': info['mediaURI'],
35 'ext': 'flv',
36 'title': info['title'],
37 'thumbnail': info['screenshotURI'],
38 'description': info['description'],
39 'uploader': info['user'],
40 'view_count': info['numberOfViews'],
41 'upload_date': '%04i%02i%02i' % (date.tm_year, date.tm_mon, date.tm_mday),
42 }