godtube.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. from .common import InfoExtractor
  2. from ..utils import (
  3. parse_duration,
  4. parse_iso8601,
  5. )
  6. class GodTubeIE(InfoExtractor):
  7. _WORKING = False
  8. _VALID_URL = r'https?://(?:www\.)?godtube\.com/watch/\?v=(?P<id>[\da-zA-Z]+)'
  9. _TESTS = [
  10. {
  11. 'url': 'https://www.godtube.com/watch/?v=0C0CNNNU',
  12. 'md5': '77108c1e4ab58f48031101a1a2119789',
  13. 'info_dict': {
  14. 'id': '0C0CNNNU',
  15. 'ext': 'mp4',
  16. 'title': 'Woman at the well.',
  17. 'duration': 159,
  18. 'timestamp': 1205712000,
  19. 'uploader': 'beverlybmusic',
  20. 'upload_date': '20080317',
  21. 'thumbnail': r're:^https?://.*\.jpg$',
  22. },
  23. },
  24. ]
  25. def _real_extract(self, url):
  26. mobj = self._match_valid_url(url)
  27. video_id = mobj.group('id')
  28. config = self._download_xml(
  29. f'http://www.godtube.com/resource/mediaplayer/{video_id.lower()}.xml',
  30. video_id, 'Downloading player config XML')
  31. video_url = config.find('file').text
  32. uploader = config.find('author').text
  33. timestamp = parse_iso8601(config.find('date').text)
  34. duration = parse_duration(config.find('duration').text)
  35. thumbnail = config.find('image').text
  36. media = self._download_xml(
  37. f'http://www.godtube.com/media/xml/?v={video_id}', video_id, 'Downloading media XML')
  38. title = media.find('title').text
  39. return {
  40. 'id': video_id,
  41. 'url': video_url,
  42. 'title': title,
  43. 'thumbnail': thumbnail,
  44. 'timestamp': timestamp,
  45. 'uploader': uploader,
  46. 'duration': duration,
  47. }