logo

youtube-dl

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

cloudy.py (1898B)


  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. str_to_int,
  6. unified_strdate,
  7. )
  8. class CloudyIE(InfoExtractor):
  9. _IE_DESC = 'cloudy.ec'
  10. _VALID_URL = r'https?://(?:www\.)?cloudy\.ec/(?:v/|embed\.php\?.*?\bid=)(?P<id>[A-Za-z0-9]+)'
  11. _TESTS = [{
  12. 'url': 'https://www.cloudy.ec/v/af511e2527aac',
  13. 'md5': '29832b05028ead1b58be86bf319397ca',
  14. 'info_dict': {
  15. 'id': 'af511e2527aac',
  16. 'ext': 'mp4',
  17. 'title': 'Funny Cats and Animals Compilation june 2013',
  18. 'upload_date': '20130913',
  19. 'view_count': int,
  20. }
  21. }, {
  22. 'url': 'http://www.cloudy.ec/embed.php?autoplay=1&id=af511e2527aac',
  23. 'only_matching': True,
  24. }]
  25. def _real_extract(self, url):
  26. video_id = self._match_id(url)
  27. webpage = self._download_webpage(
  28. 'https://www.cloudy.ec/embed.php', video_id, query={
  29. 'id': video_id,
  30. 'playerPage': 1,
  31. 'autoplay': 1,
  32. })
  33. info = self._parse_html5_media_entries(url, webpage, video_id)[0]
  34. webpage = self._download_webpage(
  35. 'https://www.cloudy.ec/v/%s' % video_id, video_id, fatal=False)
  36. if webpage:
  37. info.update({
  38. 'title': self._search_regex(
  39. r'<h\d[^>]*>([^<]+)<', webpage, 'title'),
  40. 'upload_date': unified_strdate(self._search_regex(
  41. r'>Published at (\d{4}-\d{1,2}-\d{1,2})', webpage,
  42. 'upload date', fatal=False)),
  43. 'view_count': str_to_int(self._search_regex(
  44. r'([\d,.]+) views<', webpage, 'view count', fatal=False)),
  45. })
  46. if not info.get('title'):
  47. info['title'] = video_id
  48. info['id'] = video_id
  49. return info