2 from __future__ import unicode_literals
6 from .common import InfoExtractor
14 class PinkbikeIE(InfoExtractor):
15 _VALID_URL = r'https?://(?:www\.)?pinkbike\.com/video/(?P<id>[0-9]+)'
17 'url': 'http://www.pinkbike.com/video/402811/',
18 'md5': '4814b8ca7651034cd87e3361d5c2155a',
22 'title': 'Brandon Semenuk - RAW 100',
23 'thumbnail': 're:^https?://.*\.jpg$',
24 'location': 'Victoria, British Columbia, Canada',
25 'uploader_id': 'revelco',
26 'upload_date': '20150406',
27 'description': 'Official release: www.redbull.ca/rupertwalker',
31 'url': 'http://www.pinkbike.com/video/406629/',
32 'md5': 'c7a3e19a2bd5cde5a1cda6b2b46caa74',
36 'title': 'Chromag: Reece Wallace in Utah',
37 'thumbnail': 're:^https?://.*\.jpg$',
38 'location': 'Whistler, British Columbia, Canada',
39 'uploader_id': 'Chromagbikes',
40 'upload_date': '20150505',
41 'description': 'Reece Wallace shredding Virgin, Utah. Video by Virtu Media.',
46 def _real_extract(self, url):
47 video_id = self._match_id(url)
48 webpage = self._download_webpage(url, video_id)
50 title = self._html_search_regex(r'<title>(.*?)</title>', webpage, 'title')
51 title = remove_end(title, ' Video - Pinkbike')
53 description = self._html_search_meta('description', webpage, 'description')
54 description = remove_start(description, title + '. ')
56 duration = int_or_none(self._html_search_meta(
57 'video:duration', webpage, 'duration'))
59 uploader_id = self._html_search_regex(r'un:\s*"(.*?)"', webpage, 'uploader_id')
61 upload_date = self._html_search_regex(
62 r'class="fullTime"\s*title="([0-9]{4}(?:-[0-9]{2}){2})"',
63 webpage, 'upload_date')
64 upload_date = upload_date.replace('-', '')
66 location = self._html_search_regex(
67 r'<dt>Location</dt>\n?\s*<dd>\n?(.*?)\s*<img',
71 r'<source data-quality=\\"([0-9]+)p\\" src=\\"(.*?)\\">',
74 formats = [{'url': fmt[1], 'height': int_or_none(fmt[0])} for fmt in formats]
79 'description': description,
81 'thumbnail': self._html_search_meta('og:image', webpage, 'thumbnail'),
82 'uploader_id': uploader_id,
83 'upload_date': upload_date,