parent
6610eb4421
commit
0d8380939f
@ -1,3 +0,0 @@ |
||||
[scdl] |
||||
auth_token = |
||||
path = . |
@ -1,29 +0,0 @@ |
||||
# -*- encoding: utf-8 -*- |
||||
|
||||
import requests |
||||
from scdl import CLIENT_ID, USER_AGENT |
||||
|
||||
|
||||
class Client(): |
||||
|
||||
def get_collection(self, url, token): |
||||
params = { |
||||
'client_id': CLIENT_ID, |
||||
'linked_partitioning': '1', |
||||
} |
||||
if token: |
||||
params['oauth_token'] = token |
||||
resources = list() |
||||
while url: |
||||
response = requests.get(url, params=params, headers={'User-Agent': USER_AGENT}) |
||||
response.raise_for_status() |
||||
json_data = response.json() |
||||
if 'collection' in json_data: |
||||
resources.extend(json_data['collection']) |
||||
else: |
||||
resources.extend(json_data) |
||||
if 'next_href' in json_data: |
||||
url = json_data['next_href'] |
||||
else: |
||||
url = None |
||||
return resources |
@ -0,0 +1,17 @@ |
||||
[scdl] |
||||
client_id = a3e059563d7fd3372b49b37f00a00bcf |
||||
auth_token = |
||||
path = . |
||||
name_format = {title} |
||||
playlist_name_format = {playlist[title]}_{playlist[tracknumber]}_{title} |
||||
|
||||
# example name_format values: |
||||
# {timestamp}_{user[username]}_{title} |
||||
# {id}_{user[username]}_{title} |
||||
# {id}_{user[id]}_{title} |
||||
# list of all BasicTrack attributes can be found at: https://github.com/7x11x13/soundcloud.py/blob/main/soundcloud/resource/track.py#L35 |
||||
|
||||
# playlist_name_format playlist attributes: |
||||
# playlist[author] - username of playlist author |
||||
# playlist[title] - name of playlist |
||||
# playlist[tracknumber] - tracknumber of track in playlist (zero-padded) |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue