Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"ms-python.python"
]
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"githubPullRequests.ignoredPullRequestBranches": [
"master"
]
}
28 changes: 12 additions & 16 deletions soundscrape/soundscrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,28 +167,24 @@ def process_soundcloud(vargs):
resolved = client.get('/resolve', url=track_url, limit=200)

elif likes:
userId = str(client.get('/resolve', url=artist_url).id)

resolved = client.get('/users/' + userId + '/favorites', limit=200, linked_partitioning=1)
next_href = False
if(hasattr(resolved, 'next_href')):
next_href = resolved.next_href
while (next_href):

resolved2 = requests.get(next_href).json()
if('next_href' in resolved2):
next_href = resolved2['next_href']
else:
next_href = False
resolved2 = soundcloud.resource.ResourceList(resolved2['collection'])
resolved.collection.extend(resolved2)
puts_safe(colored.green('Loading Likes...'))
user_id = str(client.get('/resolve', url=artist_url).id)
resolved = client.get('/users/' + user_id + '/favorites', limit=200, linked_partitioning=1)
next_href = getattr(resolved, 'next_href', None)

while next_href:
puts_safe(colored.white('Loading (more) likes...'))
temp_resolved = client.get(next_href)
next_href = getattr(temp_resolved, 'next_href', None)

resolved.collection.extend(temp_resolved.collection)
puts_safe(colored.green('Loaded ' + str(len(resolved.collection)) + ' Likes...'))
resolved = resolved.collection

else:
resolved = client.get('/resolve', url=artist_url, limit=200)

except Exception as e: # HTTPError?

# SoundScrape is trying to prevent us from downloading this.
# We're going to have to stop trusting the API/client and
# do all our own scraping. Boo.
Expand Down