logo

youtube-dl

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

yourupload.py (1411B)


  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import urljoin
  5. class YourUploadIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:www\.)?(?:yourupload\.com/(?:watch|embed)|embed\.yourupload\.com)/(?P<id>[A-Za-z0-9]+)'
  7. _TESTS = [{
  8. 'url': 'http://yourupload.com/watch/14i14h',
  9. 'md5': '5e2c63385454c557f97c4c4131a393cd',
  10. 'info_dict': {
  11. 'id': '14i14h',
  12. 'ext': 'mp4',
  13. 'title': 'BigBuckBunny_320x180.mp4',
  14. 'thumbnail': r're:^https?://.*\.jpe?g',
  15. }
  16. }, {
  17. 'url': 'http://www.yourupload.com/embed/14i14h',
  18. 'only_matching': True,
  19. }, {
  20. 'url': 'http://embed.yourupload.com/14i14h',
  21. 'only_matching': True,
  22. }]
  23. def _real_extract(self, url):
  24. video_id = self._match_id(url)
  25. embed_url = 'http://www.yourupload.com/embed/%s' % video_id
  26. webpage = self._download_webpage(embed_url, video_id)
  27. title = self._og_search_title(webpage)
  28. video_url = urljoin(embed_url, self._og_search_video_url(webpage))
  29. thumbnail = self._og_search_thumbnail(webpage, default=None)
  30. return {
  31. 'id': video_id,
  32. 'title': title,
  33. 'url': video_url,
  34. 'thumbnail': thumbnail,
  35. 'http_headers': {
  36. 'Referer': embed_url,
  37. },
  38. }