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.

36 lines
1.1 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from ..utils import (
  4. compat_urllib_parse
  5. )
  6. class VideoFunIE(InfoExtractor):
  7. _VALID_URL = r'http://[w.]*videofun\.me/embed/(?P<id>[0-9a-f]+)'
  8. _TEST = {
  9. 'url': 'http://videofun.me/embed/8267659be070860af600fee7deadbcdb?w=600&h=438',
  10. 'md5': 'e37e99d665f503dd2db952f7c4dba9e6',
  11. 'info_dict': {
  12. 'id': 'Mahou-Shoujo-Madoka-Magica-07',
  13. 'ext': 'flv',
  14. 'title': 'Mahou-Shoujo-Madoka-Magica-07',
  15. }
  16. }
  17. def _real_extract(self, url):
  18. video_id = self._match_id(url)
  19. webpage = self._download_webpage(
  20. url, video_id, 'Downloading video page')
  21. video_url_encoded = self._html_search_regex(
  22. r'url: "(http://gateway\.videofun\.me[^"]+)"', webpage, 'video url')
  23. video_url = compat_urllib_parse.unquote(video_url_encoded)
  24. title = self._html_search_regex(r'.*/([^.]*)\.', video_url, 'title')
  25. return {
  26. 'id': title,
  27. 'url': video_url,
  28. 'title': title,
  29. }