2
0

nuvid.py 1.3 KB

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