[audius:artist] Add extractor (#323)

Authored by: king-millez
This commit is contained in:
king-millez 2021-05-20 18:28:52 +10:00 committed by pukkandan
parent d3fc8074a4
commit 98784ef8d6
No known key found for this signature in database
GPG key ID: 0F00D95A001F4698
2 changed files with 30 additions and 1 deletions

View file

@ -245,3 +245,31 @@ def _real_extract(self, url):
return self.playlist_result(entries, playlist_id, return self.playlist_result(entries, playlist_id,
playlist_data.get('playlist_name', title), playlist_data.get('playlist_name', title),
playlist_data.get('description')) playlist_data.get('description'))
class AudiusProfileIE(AudiusPlaylistIE):
IE_NAME = 'audius:artist'
IE_DESC = 'Audius.co profile/artist pages'
_VALID_URL = r'https?://(?:www)?audius\.co/(?P<id>[^\/]+)/?(?:[?#]|$)'
_TEST = {
'url': 'https://audius.co/pzl/',
'info_dict': {
'id': 'ezRo7',
'description': 'TAMALE\n\nContact: officialpzl@gmail.com',
'title': 'pzl',
},
'playlist_count': 24,
}
def _real_extract(self, url):
self._select_api_base()
profile_id = self._match_id(url)
try:
_profile_data = self._api_request('/full/users/handle/' + profile_id, profile_id)
except ExtractorError as e:
raise ExtractorError('Could not download profile info; ' + str(e))
profile_audius_id = _profile_data[0]['id']
profile_bio = _profile_data[0].get('bio')
api_call = self._api_request('/full/users/handle/%s/tracks' % profile_id, profile_id)
return self.playlist_result(self._build_playlist(api_call), profile_audius_id, profile_id, profile_bio)

View file

@ -94,7 +94,8 @@
from .audius import ( from .audius import (
AudiusIE, AudiusIE,
AudiusTrackIE, AudiusTrackIE,
AudiusPlaylistIE AudiusPlaylistIE,
AudiusProfileIE,
) )
from .awaan import ( from .awaan import (
AWAANIE, AWAANIE,