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.

46 lines
1.7 KiB

  1. import re
  2. from .common import InfoExtractor
  3. from ..utils import (
  4. find_xpath_attr,
  5. determine_ext,
  6. )
  7. class VideofyMeIE(InfoExtractor):
  8. _VALID_URL = r'https?://(www\.videofy\.me/.+?|p\.videofy\.me/v)/(?P<id>\d+)(&|#|$)'
  9. IE_NAME = u'videofy.me'
  10. _TEST = {
  11. u'url': u'http://www.videofy.me/thisisvideofyme/1100701',
  12. u'file': u'1100701.mp4',
  13. u'md5': u'c77d700bdc16ae2e9f3c26019bd96143',
  14. u'info_dict': {
  15. u'title': u'This is VideofyMe',
  16. u'description': None,
  17. u'uploader': u'VideofyMe',
  18. u'uploader_id': u'thisisvideofyme',
  19. },
  20. }
  21. def _real_extract(self, url):
  22. mobj = re.match(self._VALID_URL, url)
  23. video_id = mobj.group('id')
  24. config = self._download_xml('http://sunshine.videofy.me/?videoId=%s' % video_id,
  25. video_id)
  26. video = config.find('video')
  27. sources = video.find('sources')
  28. url_node = next(node for node in [find_xpath_attr(sources, 'source', 'id', 'HQ %s' % key)
  29. for key in ['on', 'av', 'off']] if node is not None)
  30. video_url = url_node.find('url').text
  31. return {'id': video_id,
  32. 'title': video.find('title').text,
  33. 'url': video_url,
  34. 'ext': determine_ext(video_url),
  35. 'thumbnail': video.find('thumb').text,
  36. 'description': video.find('description').text,
  37. 'uploader': config.find('blog/name').text,
  38. 'uploader_id': video.find('identifier').text,
  39. 'view_count': re.search(r'\d+', video.find('views').text).group(),
  40. }