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