anitube.py 961 B

123456789101112131415161718192021222324252627282930313233
  1. from __future__ import unicode_literals
  2. import re
  3. from .nuevo import NuevoBaseIE
  4. class AnitubeIE(NuevoBaseIE):
  5. IE_NAME = 'anitube.se'
  6. _VALID_URL = r'https?://(?:www\.)?anitube\.se/video/(?P<id>\d+)'
  7. _TEST = {
  8. 'url': 'http://www.anitube.se/video/36621',
  9. 'md5': '59d0eeae28ea0bc8c05e7af429998d43',
  10. 'info_dict': {
  11. 'id': '36621',
  12. 'ext': 'mp4',
  13. 'title': 'Recorder to Randoseru 01',
  14. 'duration': 180.19,
  15. },
  16. 'skip': 'Blocked in the US',
  17. }
  18. def _real_extract(self, url):
  19. mobj = re.match(self._VALID_URL, url)
  20. video_id = mobj.group('id')
  21. webpage = self._download_webpage(url, video_id)
  22. key = self._search_regex(
  23. r'src=["\']https?://[^/]+/embed/([A-Za-z0-9_-]+)', webpage, 'key')
  24. config_url = 'http://www.anitube.se/nuevo/econfig.php?key=%s' % key
  25. return self._extract_nuevo(config_url, video_id)