]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/kamcord.py
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
4 from ..compat
import compat_str
11 class KamcordIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?kamcord\.com/v/(?P<id>[^/?#&]+)'
14 'url': 'https://www.kamcord.com/v/hNYRduDgWb4',
15 'md5': 'c3180e8a9cfac2e86e1b88cb8751b54c',
19 'title': 'Drinking Madness',
20 'uploader': 'jacksfilms',
21 'uploader_id': '3044562',
28 def _real_extract(self
, url
):
29 video_id
= self
._match
_id
(url
)
31 webpage
= self
._download
_webpage
(url
, video_id
)
33 video
= self
._parse
_json
(
35 r
'window\.__props\s*=\s*({.+?});?(?:\n|\s*</script)',
39 title
= video
['title']
41 formats
= self
._extract
_m
3u8_formats
(
42 video
['play']['hls'], video_id
, 'mp4', entry_protocol
='m3u8_native')
43 self
._sort
_formats
(formats
)
45 uploader
= video
.get('user', {}).get('username')
46 uploader_id
= video
.get('user', {}).get('id')
48 view_count
= int_or_none(video
.get('viewCount'))
49 like_count
= int_or_none(video
.get('heartCount'))
50 comment_count
= int_or_none(video
.get('messageCount'))
52 preference_key
= qualities(('small', 'medium', 'large'))
57 'preference': preference_key(thumbnail_id
),
58 } for thumbnail_id
, thumbnail_url
in (video
.get('thumbnail') or {}).items()
59 if isinstance(thumbnail_id
, compat_str
) and isinstance(thumbnail_url
, compat_str
)]
65 'uploader_id': uploader_id
,
66 'view_count': view_count
,
67 'like_count': like_count
,
68 'comment_count': comment_count
,
69 'thumbnails': thumbnails
,