3 from .common
import InfoExtractor
13 class PinkbikeIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:(?:www\.)?pinkbike\.com/video/|es\.pinkbike\.org/i/kvid/kvid-y5\.swf\?id=)(?P<id>[0-9]+)'
16 'url': 'http://www.pinkbike.com/video/402811/',
17 'md5': '4814b8ca7651034cd87e3361d5c2155a',
21 'title': 'Brandon Semenuk - RAW 100',
22 'description': 'Official release: www.redbull.ca/rupertwalker',
23 'thumbnail': r
're:^https?://.*\.jpg$',
25 'upload_date': '20150406',
26 'uploader': 'revelco',
27 'location': 'Victoria, British Columbia, Canada',
32 'url': 'http://es.pinkbike.org/i/kvid/kvid-y5.swf?id=406629',
33 'only_matching': True,
36 def _real_extract(self
, url
):
37 video_id
= self
._match
_id
(url
)
39 webpage
= self
._download
_webpage
(
40 f
'http://www.pinkbike.com/video/{video_id}', video_id
)
43 for _
, format_id
, src
in re
.findall(
44 r
'data-quality=((?:\\)?["\'])(.+?
)\
1[^
>]+src
=\
1(.+?
)\
1', webpage):
45 height = int_or_none(self._search_regex(
46 r'^
(\d
+)[pP
]$
', format_id, 'height
', default=None))
49 'format_id
': format_id,
53 title = remove_end(self._og_search_title(webpage), ' Video
- Pinkbike
')
54 description = self._html_search_regex(
55 r'(?s
)id="media-description"[^
>]*>(.+?
)<',
56 webpage, 'description
', default=None) or remove_start(
57 self._og_search_description(webpage), title + '. ')
58 thumbnail = self._og_search_thumbnail(webpage)
59 duration = int_or_none(self._html_search_meta(
60 'video
:duration
', webpage, 'duration
'))
62 uploader = self._search_regex(
63 r'<a
[^
>]+\brel
=["\']author[^>]+>([^<]+)', webpage,
64 'uploader', fatal=False)
65 upload_date = unified_strdate(self._search_regex(
66 r'class="fullTime
"[^>]+title="([^
"]+)"',
67 webpage, 'upload date
', fatal=False))
69 location = self._html_search_regex(
70 r'(?s
)<dt
>Location
</dt
>\s
*<dd
>(.+?
)<',
71 webpage, 'location
', fatal=False)
73 def extract_count(webpage, label):
74 return str_to_int(self._search_regex(
75 rf'<span
[^
>]+class="stat-num"[^
>]*>([\d
,.]+)</span
>\s
*<span
[^
>]+class="stat-label"[^
>]*>{label}
',
76 webpage, label, fatal=False))
78 view_count = extract_count(webpage, 'Views
')
79 comment_count = extract_count(webpage, 'Comments
')
84 'description
': description,
85 'thumbnail
': thumbnail,
87 'upload_date
': upload_date,
90 'view_count
': view_count,
91 'comment_count
': comment_count,