1 from .common
import InfoExtractor
12 class GoProIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(www\.)?gopro\.com/v/(?P<id>[A-Za-z0-9]+)'
16 'url': 'https://gopro.com/v/ZNVvED8QDzR5V',
18 'id': 'ZNVvED8QDzR5V',
19 'title': 'My GoPro Adventure - 9/19/21',
20 'thumbnail': r
're:https?://.+',
22 'timestamp': 1632072947,
23 'upload_date': '20210919',
24 'uploader_id': 'fireydive30018',
28 'url': 'https://gopro.com/v/KRm6Vgp2peg4e',
30 'id': 'KRm6Vgp2peg4e',
31 'title': 'じゃがいも カリカリ オーブン焼き',
32 'thumbnail': r
're:https?://.+',
34 'timestamp': 1607231125,
35 'upload_date': '20201206',
36 'uploader_id': 'dc9bcb8b-47d2-47c6-afbc-4c48f9a3769e',
38 'track': 'The Sky Machine',
41 'url': 'https://gopro.com/v/kVrK9wlJvBMwn',
43 'id': 'kVrK9wlJvBMwn',
45 'thumbnail': r
're:https?://.+',
47 'timestamp': 1594183735,
48 'upload_date': '20200708',
49 'uploader_id': '闇夜乃皇帝',
51 'track': 'Battery (Live)',
52 'artist': 'Metallica',
56 def _real_extract(self
, url
):
57 video_id
= self
._match
_id
(url
)
58 webpage
= self
._download
_webpage
(url
, video_id
)
60 metadata
= self
._search
_json
(
61 r
'window\.__reflectData\s*=', webpage
, 'metadata', video_id
)
63 video_info
= metadata
['collectionMedia'][0]
64 media_data
= self
._download
_json
(
65 'https://api.gopro.com/media/{}/download'.format(video_info
['id']), video_id
)
68 for fmt
in try_get(media_data
, lambda x
: x
['_embedded']['variations']) or []:
69 format_url
= url_or_none(fmt
.get('url'))
74 'format_id': str_or_none(fmt
.get('quality')),
75 'format_note': str_or_none(fmt
.get('label')),
76 'ext': str_or_none(fmt
.get('type')),
77 'width': int_or_none(fmt
.get('width')),
78 'height': int_or_none(fmt
.get('height')),
82 try_get(metadata
, lambda x
: x
['collection']['title'])
83 or self
._html
_search
_meta
(['og:title', 'twitter:title'], webpage
)
84 or remove_end(self
._html
_search
_regex
(
85 r
'<title[^>]*>([^<]+)</title>', webpage
, 'title', fatal
=False), ' | GoPro'))
87 title
= title
.replace('\n', ' ')
93 'thumbnail': url_or_none(
94 self
._html
_search
_meta
(['og:image', 'twitter:image'], webpage
)),
95 'timestamp': unified_timestamp(
96 try_get(metadata
, lambda x
: x
['collection']['created_at'])),
97 'uploader_id': str_or_none(
98 try_get(metadata
, lambda x
: x
['account']['nickname'])),
99 'duration': int_or_none(
100 video_info
.get('source_duration')),
101 'artist': str_or_none(
102 video_info
.get('music_track_artist')) or None,
103 'track': str_or_none(
104 video_info
.get('music_track_name')) or None,