moevideo.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. from .common import InfoExtractor
  2. from ..utils import (
  3. clean_html,
  4. int_or_none,
  5. )
  6. class MoeVideoIE(InfoExtractor):
  7. IE_DESC = 'LetitBit video services: moevideo.net, playreplay.net and videochart.net'
  8. _VALID_URL = r'''(?x)
  9. https?://(?P<host>(?:www\.)?
  10. (?:(?:moevideo|playreplay|videochart)\.net|thesame\.tv))/
  11. (?:video|framevideo|embed)/(?P<id>[0-9a-z]+\.[0-9A-Za-z]+)'''
  12. _API_URL = 'http://api.letitbit.net/'
  13. _API_KEY = 'tVL0gjqo5'
  14. _TESTS = [
  15. {
  16. 'url': 'http://moevideo.net/video/00297.0036103fe3d513ef27915216fd29',
  17. 'md5': '129f5ae1f6585d0e9bb4f38e774ffb3a',
  18. 'info_dict': {
  19. 'id': '00297.0036103fe3d513ef27915216fd29',
  20. 'ext': 'flv',
  21. 'title': 'Sink cut out machine',
  22. 'description': 'md5:f29ff97b663aefa760bf7ca63c8ca8a8',
  23. 'thumbnail': r're:^https?://.*\.jpg$',
  24. 'width': 540,
  25. 'height': 360,
  26. 'duration': 179,
  27. 'filesize': 17822500,
  28. },
  29. 'skip': 'Video has been removed',
  30. },
  31. {
  32. 'url': 'http://playreplay.net/video/77107.7f325710a627383d40540d8e991a',
  33. 'md5': '74f0a014d5b661f0f0e2361300d1620e',
  34. 'info_dict': {
  35. 'id': '77107.7f325710a627383d40540d8e991a',
  36. 'ext': 'flv',
  37. 'title': 'Operacion Condor.',
  38. 'description': 'md5:7e68cb2fcda66833d5081c542491a9a3',
  39. 'thumbnail': r're:^https?://.*\.jpg$',
  40. 'width': 480,
  41. 'height': 296,
  42. 'duration': 6027,
  43. 'filesize': 588257923,
  44. },
  45. 'skip': 'Video has been removed',
  46. },
  47. ]
  48. def _real_extract(self, url):
  49. host, video_id = self._match_valid_url(url).groups()
  50. webpage = self._download_webpage(
  51. 'http://%s/video/%s' % (host, video_id),
  52. video_id, 'Downloading webpage')
  53. title = self._og_search_title(webpage)
  54. embed_webpage = self._download_webpage(
  55. 'http://%s/embed/%s' % (host, video_id),
  56. video_id, 'Downloading embed webpage')
  57. video = self._parse_json(self._search_regex(
  58. r'mvplayer\("#player"\s*,\s*({.+})',
  59. embed_webpage, 'mvplayer'), video_id)['video']
  60. return {
  61. 'id': video_id,
  62. 'title': title,
  63. 'thumbnail': video.get('poster') or self._og_search_thumbnail(webpage),
  64. 'description': clean_html(self._og_search_description(webpage)),
  65. 'duration': int_or_none(self._og_search_property('video:duration', webpage)),
  66. 'url': video['ourUrl'],
  67. }