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.

52 lines
1.7 KiB

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