logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

behindkink.py (1647B)


  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. from ..utils import url_basename
  6. class BehindKinkIE(InfoExtractor):
  7. _VALID_URL = r'https?://(?:www\.)?behindkink\.com/(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/(?P<day>[0-9]{2})/(?P<id>[^/#?_]+)'
  8. _TEST = {
  9. 'url': 'http://www.behindkink.com/2014/12/05/what-are-you-passionate-about-marley-blaze/',
  10. 'md5': '507b57d8fdcd75a41a9a7bdb7989c762',
  11. 'info_dict': {
  12. 'id': '37127',
  13. 'ext': 'mp4',
  14. 'title': 'What are you passionate about – Marley Blaze',
  15. 'description': 'md5:aee8e9611b4ff70186f752975d9b94b4',
  16. 'upload_date': '20141205',
  17. 'thumbnail': 'http://www.behindkink.com/wp-content/uploads/2014/12/blaze-1.jpg',
  18. 'age_limit': 18,
  19. }
  20. }
  21. def _real_extract(self, url):
  22. mobj = re.match(self._VALID_URL, url)
  23. display_id = mobj.group('id')
  24. webpage = self._download_webpage(url, display_id)
  25. video_url = self._search_regex(
  26. r'<source src="([^"]+)"', webpage, 'video URL')
  27. video_id = url_basename(video_url).split('_')[0]
  28. upload_date = mobj.group('year') + mobj.group('month') + mobj.group('day')
  29. return {
  30. 'id': video_id,
  31. 'display_id': display_id,
  32. 'url': video_url,
  33. 'title': self._og_search_title(webpage),
  34. 'thumbnail': self._og_search_thumbnail(webpage),
  35. 'description': self._og_search_description(webpage),
  36. 'upload_date': upload_date,
  37. 'age_limit': 18,
  38. }