3 from .common
import InfoExtractor
11 class DroobleIE(InfoExtractor
):
12 _VALID_URL
= r
'''(?x)https?://drooble\.com/(?:
13 (?:(?P<user>[^/]+)/)?(?P<kind>song|videos|music/albums)/(?P<id>\d+)|
14 (?P<user_2>[^/]+)/(?P<kind_2>videos|music))
17 'url': 'https://drooble.com/song/2858030',
18 'md5': '5ffda90f61c7c318dc0c3df4179eb064',
22 'title': 'Skankocillin',
23 'upload_date': '20200801',
24 'timestamp': 1596241390,
25 'uploader_id': '95894',
26 'uploader': 'Bluebeat Shelter',
29 'url': 'https://drooble.com/karl340758/videos/2859183',
33 'title': 'Skankocillin',
34 'uploader_id': 'UCrSRoI5vVyeYihtWEYua7rg',
35 'description': 'md5:ffc0bd8ba383db5341a86a6cd7d9bcca',
36 'upload_date': '20200731',
37 'uploader': 'Bluebeat Shelter',
40 'url': 'https://drooble.com/karl340758/music/albums/2858031',
44 'playlist_mincount': 8,
46 'url': 'https://drooble.com/karl340758/music',
50 'playlist_mincount': 8,
52 'url': 'https://drooble.com/karl340758/videos',
56 'playlist_mincount': 8,
59 def _call_api(self
, method
, video_id
, data
=None):
60 response
= self
._download
_json
(
61 f
'https://drooble.com/api/dt/{method}', video_id
, data
=json
.dumps(data
).encode())
63 raise ExtractorError('Unable to download JSON metadata')
66 def _real_extract(self
, url
):
67 mobj
= self
._match
_valid
_url
(url
)
68 user
= mobj
.group('user') or mobj
.group('user_2')
69 kind
= mobj
.group('kind') or mobj
.group('kind_2')
70 display_id
= mobj
.group('id') or user
72 if mobj
.group('kind_2') == 'videos':
73 data
= {'from_user': display_id
, 'album': -1, 'limit': 18, 'offset': 0, 'order': 'new2old', 'type': 'video'}
74 elif kind
in ('music/albums', 'music'):
75 data
= {'user': user
, 'public_only': True, 'individual_limit': {'singles': 1, 'albums': 1, 'playlists': 1}}
77 data
= {'url_slug': display_id
, 'children': 10, 'order': 'old2new'}
79 method
= 'getMusicOverview' if kind
in ('music/albums', 'music') else 'getElements'
80 json_data
= self
._call
_api
(method
, display_id
, data
=data
)
81 if kind
in ('music/albums', 'music'):
82 json_data
= json_data
['singles']['list']
85 for media
in json_data
:
86 url
= media
.get('external_media_url') or media
.get('link')
87 if url
.startswith('https://www.youtube.com'):
94 is_audio
= (media
.get('type') or '').lower() == 'audio'
98 'title': media
['title'],
99 'duration': int_or_none(media
.get('duration')),
100 'timestamp': int_or_none(media
.get('timestamp')),
101 'album': try_get(media
, lambda x
: x
['album']['title']),
102 'uploader': try_get(media
, lambda x
: x
['creator']['display_name']),
103 'uploader_id': try_get(media
, lambda x
: x
['creator']['id']),
104 'thumbnail': media
.get('image_comment'),
105 'like_count': int_or_none(media
.get('likes')),
106 'vcodec': 'none' if is_audio
else None,
107 'ext': 'mp3' if is_audio
else None,
111 return self
.playlist_result(entites
, display_id
)