]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/pinkbike.py
a52210fabf538bff34cc39029f07778755873b65
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
16 class PinkbikeIE(InfoExtractor
):
17 _VALID_URL
= r
'https?://(?:(?:www\.)?pinkbike\.com/video/|es\.pinkbike\.org/i/kvid/kvid-y5\.swf\?id=)(?P<id>[0-9]+)'
19 'url': 'http://www.pinkbike.com/video/402811/',
20 'md5': '4814b8ca7651034cd87e3361d5c2155a',
24 'title': 'Brandon Semenuk - RAW 100',
25 'description': 'Official release: www.redbull.ca/rupertwalker',
26 'thumbnail': 're:^https?://.*\.jpg$',
28 'upload_date': '20150406',
29 'uploader': 'revelco',
30 'location': 'Victoria, British Columbia, Canada',
35 'url': 'http://es.pinkbike.org/i/kvid/kvid-y5.swf?id=406629',
36 'only_matching': True,
39 def _real_extract(self
, url
):
40 video_id
= self
._match
_id
(url
)
42 webpage
= self
._download
_webpage
(
43 'http://www.pinkbike.com/video/%s' % video_id
, video_id
)
46 for _
, format_id
, src
in re
.findall(
47 r
'data-quality=((?:\\)?["\'])(.+?
)\
1[^
>]+src
=\
1(.+?
)\
1', webpage):
48 height = int_or_none(self._search_regex(
49 r'^
(\d
+)[pP
]$
', format_id, 'height
', default=None))
52 'format_id
': format_id,
55 self._sort_formats(formats)
57 title = remove_end(self._og_search_title(webpage), ' Video
- Pinkbike
')
58 description = self._html_search_regex(
59 r'(?s
)id="media-description"[^
>]*>(.+?
)<',
60 webpage, 'description
', default=None) or remove_start(
61 self._og_search_description(webpage), title + '. ')
62 thumbnail = self._og_search_thumbnail(webpage)
63 duration = int_or_none(self._html_search_meta(
64 'video
:duration
', webpage, 'duration
'))
66 uploader = self._search_regex(
67 r'un
:\s
*"([^"]+)"', webpage, 'uploader', fatal=False)
68 upload_date = unified_strdate(self._search_regex(
69 r'class="fullTime
"[^>]+title="([^
"]+)"',
70 webpage, 'upload date
', fatal=False))
72 location = self._html_search_regex(
73 r'(?s
)<dt
>Location
</dt
>\s
*<dd
>(.+?
)<',
74 webpage, 'location
', fatal=False)
76 def extract_count(webpage, label):
77 return str_to_int(self._search_regex(
78 r'<span
[^
>]+class="stat-num"[^
>]*>([\d
,.]+)</span
>\s
*<span
[^
>]+class="stat-label"[^
>]*>%s' % label,
79 webpage, label, fatal=False))
81 view_count = extract_count(webpage, 'Views
')
82 comment_count = extract_count(webpage, 'Comments
')
87 'description
': description,
88 'thumbnail
': thumbnail,
90 'upload_date
': upload_date,
93 'view_count
': view_count,
94 'comment_count
': comment_count,