]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/camwithher.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
13 class CamWithHerIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?camwithher\.tv/view_video\.php\?.*\bviewkey=(?P<id>\w+)'
17 'url': 'http://camwithher.tv/view_video.php?viewkey=6e9a24e2c0e842e1f177&page=&viewtype=&category=',
21 'title': 'Periscope Tease',
22 'description': 'In the clouds teasing on periscope to my favorite song',
26 'uploader': 'MileenaK',
27 'upload_date': '20160322',
30 'skip_download': True,
33 'url': 'http://camwithher.tv/view_video.php?viewkey=6dfd8b7c97531a459937',
34 'only_matching': True,
36 'url': 'http://camwithher.tv/view_video.php?page=&viewkey=6e9a24e2c0e842e1f177&viewtype=&category=',
37 'only_matching': True,
39 'url': 'http://camwithher.tv/view_video.php?viewkey=b6c3b5bea9515d1a1fc4&page=&viewtype=&category=mv',
40 'only_matching': True,
43 def _real_extract(self
, url
):
44 video_id
= self
._match
_id
(url
)
46 webpage
= self
._download
_webpage
(url
, video_id
)
48 flv_id
= self
._html
_search
_regex
(
49 r
'<a[^>]+href=["\']/download
/\?v
=(\d
+)', webpage, 'video
id')
51 # Video URL construction algorithm is reverse-engineered from cwhplayer.swf
52 rtmp_url = 'rtmp
://camwithher
.tv
/clipshare
/%s' % (
53 ('mp4
:%s.mp4
' % flv_id) if int(flv_id) > 2010 else flv_id)
55 title = self._html_search_regex(
56 r'<div
[^
>]+style
="float:left"[^
>]*>\s
*<h2
>(.+?
)</h2
>', webpage, 'title
')
57 description = self._html_search_regex(
58 r'>Description
:</span
>(.+?
)</div
>', webpage, 'description
', default=None)
60 runtime = self._search_regex(
61 r'Runtime\s
*:\s
*(.+?
) \|
', webpage, 'duration
', default=None)
63 runtime = re.sub(r'[\s
-]', '', runtime)
64 duration = parse_duration(runtime)
65 view_count = int_or_none(self._search_regex(
66 r'Views\s
*:\s
*(\d
+)', webpage, 'view count
', default=None))
67 comment_count = int_or_none(self._search_regex(
68 r'Comments\s
*:\s
*(\d
+)', webpage, 'comment count
', default=None))
70 uploader = self._search_regex(
71 r'Added by\s
*:\s
*<a
[^
>]+>([^
<]+)</a
>', webpage, 'uploader
', default=None)
72 upload_date = unified_strdate(self._search_regex(
73 r'Added on\s
*:\s
*([\d
-]+)', webpage, 'upload date
', default=None))
81 'description
': description,
83 'view_count
': view_count,
84 'comment_count
': comment_count,
86 'upload_date
': upload_date,