videofyme.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. from .common import InfoExtractor
  2. from ..utils import (
  3. int_or_none,
  4. parse_iso8601,
  5. )
  6. class VideofyMeIE(InfoExtractor):
  7. _VALID_URL = r'https?://(?:www\.videofy\.me/.+?|p\.videofy\.me/v)/(?P<id>\d+)(&|#|$)'
  8. IE_NAME = 'videofy.me'
  9. _TEST = {
  10. 'url': 'http://www.videofy.me/thisisvideofyme/1100701',
  11. 'md5': 'c77d700bdc16ae2e9f3c26019bd96143',
  12. 'info_dict': {
  13. 'id': '1100701',
  14. 'ext': 'mp4',
  15. 'title': 'This is VideofyMe',
  16. 'description': '',
  17. 'upload_date': '20130326',
  18. 'timestamp': 1364288959,
  19. 'uploader': 'VideofyMe',
  20. 'uploader_id': 'thisisvideofyme',
  21. 'view_count': int,
  22. 'likes': int,
  23. 'comment_count': int,
  24. },
  25. }
  26. def _real_extract(self, url):
  27. video_id = self._match_id(url)
  28. config = self._download_json('http://vf-player-info-loader.herokuapp.com/%s.json' % video_id, video_id)['videoinfo']
  29. video = config.get('video')
  30. blog = config.get('blog', {})
  31. return {
  32. 'id': video_id,
  33. 'title': video['title'],
  34. 'url': video['sources']['source']['url'],
  35. 'thumbnail': video.get('thumb'),
  36. 'description': video.get('description'),
  37. 'timestamp': parse_iso8601(video.get('date')),
  38. 'uploader': blog.get('name'),
  39. 'uploader_id': blog.get('identifier'),
  40. 'view_count': int_or_none(self._search_regex(r'([0-9]+)', video.get('views'), 'view count', fatal=False)),
  41. 'likes': int_or_none(video.get('likes')),
  42. 'comment_count': int_or_none(video.get('nrOfComments')),
  43. }