2014-09-13 23:12:36 +02:00
|
|
|
# coding: utf-8
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
2014-11-02 11:23:40 +01:00
|
|
|
from ..utils import (
|
2017-03-22 17:48:06 +01:00
|
|
|
str_to_int,
|
|
|
|
unified_strdate,
|
2014-11-02 11:23:40 +01:00
|
|
|
)
|
2014-09-13 23:12:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
class CloudyIE(InfoExtractor):
|
2016-07-15 19:21:20 +02:00
|
|
|
_IE_DESC = 'cloudy.ec'
|
2017-03-22 17:48:06 +01:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?cloudy\.ec/(?:v/|embed\.php\?.*?\bid=)(?P<id>[A-Za-z0-9]+)'
|
|
|
|
_TESTS = [{
|
2016-07-15 19:21:20 +02:00
|
|
|
'url': 'https://www.cloudy.ec/v/af511e2527aac',
|
2017-03-22 17:48:06 +01:00
|
|
|
'md5': '29832b05028ead1b58be86bf319397ca',
|
2016-07-15 19:21:20 +02:00
|
|
|
'info_dict': {
|
|
|
|
'id': 'af511e2527aac',
|
2017-03-22 17:48:06 +01:00
|
|
|
'ext': 'mp4',
|
2016-07-15 19:21:20 +02:00
|
|
|
'title': 'Funny Cats and Animals Compilation june 2013',
|
2017-03-22 17:48:06 +01:00
|
|
|
'upload_date': '20130913',
|
|
|
|
'view_count': int,
|
2014-09-13 23:12:36 +02:00
|
|
|
}
|
2017-03-22 17:48:06 +01:00
|
|
|
}, {
|
|
|
|
'url': 'http://www.cloudy.ec/embed.php?autoplay=1&id=af511e2527aac',
|
|
|
|
'only_matching': True,
|
|
|
|
}]
|
2014-09-14 14:04:16 +02:00
|
|
|
|
2017-03-22 17:48:06 +01:00
|
|
|
def _real_extract(self, url):
|
|
|
|
video_id = self._match_id(url)
|
2014-09-13 23:12:36 +02:00
|
|
|
|
2017-03-22 17:48:06 +01:00
|
|
|
webpage = self._download_webpage(
|
2017-07-26 18:12:43 +02:00
|
|
|
'https://www.cloudy.ec/embed.php', video_id, query={
|
|
|
|
'id': video_id,
|
|
|
|
'playerPage': 1,
|
|
|
|
'autoplay': 1,
|
|
|
|
})
|
2014-09-13 23:12:36 +02:00
|
|
|
|
2017-03-22 17:48:06 +01:00
|
|
|
info = self._parse_html5_media_entries(url, webpage, video_id)[0]
|
2014-09-14 14:04:16 +02:00
|
|
|
|
2017-03-22 17:48:06 +01:00
|
|
|
webpage = self._download_webpage(
|
|
|
|
'https://www.cloudy.ec/v/%s' % video_id, video_id, fatal=False)
|
2014-09-13 23:12:36 +02:00
|
|
|
|
2017-03-22 17:48:06 +01:00
|
|
|
if webpage:
|
|
|
|
info.update({
|
|
|
|
'title': self._search_regex(
|
|
|
|
r'<h\d[^>]*>([^<]+)<', webpage, 'title'),
|
|
|
|
'upload_date': unified_strdate(self._search_regex(
|
|
|
|
r'>Published at (\d{4}-\d{1,2}-\d{1,2})', webpage,
|
|
|
|
'upload date', fatal=False)),
|
|
|
|
'view_count': str_to_int(self._search_regex(
|
|
|
|
r'([\d,.]+) views<', webpage, 'view count', fatal=False)),
|
|
|
|
})
|
2014-09-14 14:04:16 +02:00
|
|
|
|
2017-03-22 17:48:06 +01:00
|
|
|
if not info.get('title'):
|
|
|
|
info['title'] = video_id
|
2014-09-14 14:04:16 +02:00
|
|
|
|
2017-03-22 17:48:06 +01:00
|
|
|
info['id'] = video_id
|
2014-09-14 14:04:16 +02:00
|
|
|
|
2017-03-22 17:48:06 +01:00
|
|
|
return info
|