You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.9 KiB

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