python - Tracks gotten from user are different from tracks searched -
i having problems soundcloud's api. put, track objects should identically returned api not.
tracks received client.get('tracks', q='some search')
different tracks received client.get('users/%s/tracks % some_user.id)
. tracks received search (first example) have attribute of likes_count
whereas second example not.
another thing noted favoritings_count
of search returned track 0. value of same parameter, returned user gotten track 26.
this last 1 not know if intended, values of favoritings_count
user track different values of likes_count
of searched track.
here question itself: problem api or python wrapper? there workaround?
thanks in advance.
here simple test code made show these differences:
import soundcloud client_id = 'your_id' client = soundcloud.client(client_id=client_id) user = client.get('users', q='mrjw', limit=1)[0] user_track = client.get('users/%s/tracks' % user.id, limit=1)[0] print('from user') print('title:', user_track.title) # buffalo tales got user print('id:', user_track.id) search_track = client.get('tracks', q='mrjw buffalo tales', limit=1)[0] print('from search') print('title:', search_track.title) # buffalo tales got search print('id:', search_track.id) print('search_track.favoritings_count:', search_track.favoritings_count) print('user_track.favoritings_count:', user_track.favoritings_count) print('search_track.likes_count:', search_track.likes_count) print('user_track.likes_count:', user_track.likes_count) # traceback (most recent call last): # file "test.py", line 21, in <module> # print('user_track.likes_count:', user_track.likes_count) # file "/usr/lib/python3.6/site-packages/soundcloud/resource.py", # line 34, in __getattr__ # raise attributeerror # attributeerror
Comments
Post a Comment