noodlemagazine.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. from .common import InfoExtractor
  2. from ..utils import (
  3. parse_duration,
  4. parse_count,
  5. unified_strdate
  6. )
  7. class NoodleMagazineIE(InfoExtractor):
  8. _VALID_URL = r'https?://(?:www|adult\.)?noodlemagazine\.com/watch/(?P<id>[0-9-_]+)'
  9. _TEST = {
  10. 'url': 'https://adult.noodlemagazine.com/watch/-67421364_456239604',
  11. 'md5': '9e02aa763612929d0b4b850591a9248b',
  12. 'info_dict': {
  13. 'id': '-67421364_456239604',
  14. 'title': 'Aria alexander manojob',
  15. 'thumbnail': r're:^https://.*\.jpg',
  16. 'ext': 'mp4',
  17. 'duration': 903,
  18. 'view_count': int,
  19. 'like_count': int,
  20. 'description': 'Aria alexander manojob',
  21. 'tags': ['aria', 'alexander', 'manojob'],
  22. 'upload_date': '20190218',
  23. 'age_limit': 18
  24. }
  25. }
  26. def _real_extract(self, url):
  27. video_id = self._match_id(url)
  28. webpage = self._download_webpage(url, video_id)
  29. title = self._og_search_title(webpage)
  30. duration = parse_duration(self._html_search_meta('video:duration', webpage, 'duration', default=None))
  31. description = self._og_search_property('description', webpage, default='').replace(' watch online hight quality video', '')
  32. tags = self._html_search_meta('video:tag', webpage, default='').split(', ')
  33. view_count = parse_count(self._html_search_meta('ya:ovs:views_total', webpage, default=None))
  34. like_count = parse_count(self._html_search_meta('ya:ovs:likes', webpage, default=None))
  35. upload_date = unified_strdate(self._html_search_meta('ya:ovs:upload_date', webpage, default=''))
  36. key = self._html_search_regex(rf'/{video_id}\?(?:.*&)?m=([^&"\'\s,]+)', webpage, 'key')
  37. playlist_info = self._download_json(f'https://adult.noodlemagazine.com/playlist/{video_id}?m={key}', video_id)
  38. thumbnail = self._og_search_property('image', webpage, default=None) or playlist_info.get('image')
  39. formats = [{
  40. 'url': source.get('file'),
  41. 'quality': source.get('label'),
  42. 'ext': source.get('type'),
  43. } for source in playlist_info.get('sources')]
  44. return {
  45. 'id': video_id,
  46. 'formats': formats,
  47. 'title': title,
  48. 'thumbnail': thumbnail,
  49. 'duration': duration,
  50. 'description': description,
  51. 'tags': tags,
  52. 'view_count': view_count,
  53. 'like_count': like_count,
  54. 'upload_date': upload_date,
  55. 'age_limit': 18
  56. }