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.

48 lines
1.5 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import int_or_none
  5. class ManyVidsIE(InfoExtractor):
  6. _VALID_URL = r'(?i)https?://(?:www\.)?manyvids\.com/video/(?P<id>\d+)'
  7. _TEST = {
  8. 'url': 'https://www.manyvids.com/Video/133957/everthing-about-me/',
  9. 'md5': '03f11bb21c52dd12a05be21a5c7dcc97',
  10. 'info_dict': {
  11. 'id': '133957',
  12. 'ext': 'mp4',
  13. 'title': 'everthing about me (Preview)',
  14. 'view_count': int,
  15. 'like_count': int,
  16. },
  17. }
  18. def _real_extract(self, url):
  19. video_id = self._match_id(url)
  20. webpage = self._download_webpage(url, video_id)
  21. video_url = self._search_regex(
  22. r'data-(?:video-filepath|meta-video)\s*=s*(["\'])(?P<url>(?:(?!\1).)+)\1',
  23. webpage, 'video URL', group='url')
  24. title = '%s (Preview)' % self._html_search_regex(
  25. r'<h2[^>]+class="m-a-0"[^>]*>([^<]+)', webpage, 'title')
  26. like_count = int_or_none(self._search_regex(
  27. r'data-likes=["\'](\d+)', webpage, 'like count', default=None))
  28. view_count = int_or_none(self._html_search_regex(
  29. r'(?s)<span[^>]+class="views-wrapper"[^>]*>(.+?)</span', webpage,
  30. 'view count', default=None))
  31. return {
  32. 'id': video_id,
  33. 'title': title,
  34. 'view_count': view_count,
  35. 'like_count': like_count,
  36. 'formats': [{
  37. 'url': video_url,
  38. }],
  39. }