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.4 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. class NuvidIE(InfoExtractor):
  5. _VALID_URL = r'^https?://(?:www|m)\.nuvid\.com/video/(?P<id>[0-9]+)'
  6. _TEST = {
  7. 'url': 'http://m.nuvid.com/video/1310741/',
  8. 'md5': 'eab207b7ac4fccfb4e23c86201f11277',
  9. 'info_dict': {
  10. 'id': '1310741',
  11. 'ext': 'mp4',
  12. "title": "Horny babes show their awesome bodeis and",
  13. "age_limit": 18,
  14. }
  15. }
  16. def _real_extract(self, url):
  17. mobj = re.match(self._VALID_URL, url)
  18. video_id = mobj.group('id')
  19. murl = url.replace('://www.', '://m.')
  20. webpage = self._download_webpage(murl, video_id)
  21. title = self._html_search_regex(
  22. r'<div class="title">\s+<h2[^>]*>([^<]+)</h2>',
  23. webpage, 'title').strip()
  24. url_end = self._html_search_regex(
  25. r'href="(/[^"]+)"[^>]*data-link_type="mp4"',
  26. webpage, 'video_url')
  27. video_url = 'http://m.nuvid.com' + url_end
  28. thumbnail = self._html_search_regex(
  29. r'href="(/thumbs/[^"]+)"[^>]*data-link_type="thumbs"',
  30. webpage, 'thumbnail URL', fatal=False)
  31. return {
  32. 'id': video_id,
  33. 'url': video_url,
  34. 'ext': 'mp4',
  35. 'title': title,
  36. 'thumbnail': thumbnail,
  37. 'age_limit': 18,
  38. }