2 from __future__ import unicode_literals
6 from .common import InfoExtractor
9 class PinkbikeIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?pinkbike\.com/video/(?P<id>[0-9]+)'
12 'url': 'http://www.pinkbike.com/video/402811/',
13 'md5': '4814b8ca7651034cd87e3361d5c2155a',
17 'title': 'Brandon Semenuk - RAW 100',
18 'thumbnail': 're:^https?://.*\.jpg$',
19 'location': 'Victoria, British Columbia, Canada',
20 'uploader_id': 'revelco',
21 'upload_date': '20150406',
22 'description': 'Official release: www.redbull.ca/rupertwalker',
26 'url': 'http://www.pinkbike.com/video/406629/',
27 'md5': 'c7a3e19a2bd5cde5a1cda6b2b46caa74',
31 'title': 'Chromag: Reece Wallace in Utah',
32 'thumbnail': 're:^https?://.*\.jpg$',
33 'location': 'Whistler, British Columbia, Canada',
34 'uploader_id': 'Chromagbikes',
35 'upload_date': '20150505',
36 'description': 'Reece Wallace shredding Virgin, Utah. Video by Virtu Media.',
41 def _real_extract(self, url):
42 video_id = self._match_id(url)
43 webpage = self._download_webpage(url, video_id)
45 title = self._html_search_regex(r'<title>(.*?)</title>', webpage, 'title')
46 title = title[:-len(' Video - Pinkbike')]
48 description = self._html_search_meta('description', webpage, 'description')
49 description = description[len(title + '. '):]
51 uploader_id = self._html_search_regex(r'un:\s*"(.*?)"', webpage, 'uploader_id')
53 upload_date = self._html_search_regex(
54 r'class="fullTime"\s*title="([0-9]{4}(?:-[0-9]{2}){2})"',
55 webpage, 'upload_date')
56 upload_date = upload_date.replace('-', '')
58 location = self._html_search_regex(
59 r'<dt>Location</dt>\n?\s*<dd>\n?(.*?)\s*<img',
63 r'<source data-quality=\\"([0-9]+)p\\" src=\\"(.*?)\\">',
66 formats = [{'url': fmt[1], 'height': fmt[0]} for fmt in formats]
71 'description': description,
72 'duration': self._html_search_meta('video:duration', webpage, 'duration'),
73 'thumbnail': self._html_search_meta('og:image', webpage, 'thumbnail'),
74 'uploader_id': uploader_id,
75 'upload_date': upload_date,