1 from .common
import InfoExtractor
9 class HearThisAtIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www\.)?hearthis\.at/(?P<artist>[^/?#]+)/(?P<title>[\w.-]+)'
11 _PLAYLIST_URL
= 'https://hearthis.at/playlist.php'
13 'url': 'https://hearthis.at/moofi/dr-kreep',
14 'md5': 'ab6ec33c8fed6556029337c7885eb4e0',
17 'display_id': 'moofi - dr-kreep',
19 'title': 'Moofi - Dr. Kreep',
20 'thumbnail': r
're:^https?://.*\.jpg$',
21 'timestamp': 1421564134,
22 'description': 'md5:1adb0667b01499f9d27e97ddfd53852a',
23 'upload_date': '20150118',
26 'genres': ['Experimental'],
29 # 'download' link redirects to the original webpage
30 'url': 'https://hearthis.at/twitchsf/dj-jim-hopkins-totally-bitchin-80s-dance-mix/',
31 'md5': '5980ceb7c461605d30f1f039df160c6e',
34 'display_id': 'twitchsf - dj-jim-hopkins-totally-bitchin-80s-dance-mix',
36 'title': 'TwitchSF - DJ Jim Hopkins - Totally Bitchin\' 80\'s Dance Mix!',
37 'description': 'md5:ef26815ca8f483272a87b137ff175be2',
38 'upload_date': '20160328',
39 'timestamp': 1459186146,
40 'thumbnail': r
're:^https?://.*\.jpg$',
46 'url': 'https://hearthis.at/tindalos/0001-tindalos-gnrique/eQd/',
47 'md5': 'cd08e51911f147f6da2d9678905b0bd9',
53 'timestamp': 1545471670,
54 'display_id': 'tindalos - 0001-tindalos-gnrique',
55 'thumbnail': r
're:^https?://.*\.jpg$',
57 'title': 'Tindalos - Tindalos - générique n°1',
59 'upload_date': '20181222',
62 'url': 'https://hearthis.at/sithi2/biochip-c-classics-set-wolle-xdp-tresor.core-special-tresor-globus-berlin-13.07.20011/',
63 'md5': 'b45ac60f0c8111eef6ddc10ec232e312',
67 'description': 'md5:d7ae36a453d78903f6b7ed6eb2fce1f2',
69 'thumbnail': r
're:^https?://.*\.jpg$',
70 'title': 'md5:62669ce5b1b67f45c6f846033f37d3b9',
71 'timestamp': 1588699409,
72 'display_id': 'sithi2 - biochip-c-classics-set-wolle-xdp-tresor.core-special-tresor-globus-berlin-13.07.20011',
74 'upload_date': '20200505',
79 def _real_extract(self
, url
):
80 m
= self
._match
_valid
_url
(url
)
81 display_id
= '{artist:s} - {title:s}'.format(**m
.groupdict())
82 api_url
= url
.replace('www.', '').replace('hearthis.at', 'api-v2.hearthis.at')
83 data_json
= self
._download
_json
(api_url
, display_id
)
84 track_id
= data_json
.get('id')
85 artist_json
= data_json
.get('user')
86 title
= '{} - {}'.format(artist_json
.get('username'), data_json
.get('title'))
87 genre
= data_json
.get('genre')
88 description
= data_json
.get('description')
89 thumbnail
= data_json
.get('artwork_url') or data_json
.get('thumb')
90 view_count
= str_to_int(data_json
.get('playback_count'))
91 duration
= str_to_int(data_json
.get('duration'))
92 timestamp
= data_json
.get('release_timestamp')
95 mp3_url
= data_json
.get('stream_url')
106 if data_json
.get('download_url'):
107 download_url
= data_json
['download_url']
108 ext
= determine_ext(data_json
['download_filename'])
109 if ext
in KNOWN_EXTENSIONS
:
116 'quality': 2, # Usually better quality
121 'display_id': display_id
,
124 'thumbnail': thumbnail
,
125 'description': description
,
126 'duration': duration
,
127 'timestamp': timestamp
,
128 'view_count': view_count
,