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.

56 lines
1.8 KiB

  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. 'http://www.cloudy.ec/embed.php?id=%s' % video_id, video_id)
  29. info = self._parse_html5_media_entries(url, webpage, video_id)[0]
  30. webpage = self._download_webpage(
  31. 'https://www.cloudy.ec/v/%s' % video_id, video_id, fatal=False)
  32. if webpage:
  33. info.update({
  34. 'title': self._search_regex(
  35. r'<h\d[^>]*>([^<]+)<', webpage, 'title'),
  36. 'upload_date': unified_strdate(self._search_regex(
  37. r'>Published at (\d{4}-\d{1,2}-\d{1,2})', webpage,
  38. 'upload date', fatal=False)),
  39. 'view_count': str_to_int(self._search_regex(
  40. r'([\d,.]+) views<', webpage, 'view count', fatal=False)),
  41. })
  42. if not info.get('title'):
  43. info['title'] = video_id
  44. info['id'] = video_id
  45. return info