soundcloud.py icon indicating copy to clipboard operation
soundcloud.py copied to clipboard

Listening History

Open CosmicSage opened this issue 2 years ago • 2 comments

Presently There's no way to get listening history of a user and I don't think there's anything in API Docs about listening history either.

SO is anyone interested in adding listening history to this wrapper? I willing to do it myself so if anyone has any words of wisdom please share

In dev tools its very obvious how to get listening history and it would be great if A) someone could do it B) advise me so I can get it there faster

CosmicSage avatar Feb 14 '23 16:02 CosmicSage

Here's sample response from history endpoint of there's a dict whose "collection" key has list of dicts representing history

{"collection":[{"played_at":1676474437536,"track_id":19832987,"track":{"artwork_url":"https://i1.sndcdn.com/artworks-000009722146-4vlpp9-large.jpg","caption":null,"commentable":true,"comment_count":0,"created_at":"2011-07-26T19:42:15Z","description":"","downloadable":false,"download_count":0,"duration":1510791,"full_duration":1510791,"embeddable_by":"all","genre":"Dubstep","has_downloads_left":false,"id":19832987,"kind":"track","label_name":"","last_modified":"2011-07-26T19:44:40Z","license":"all-rights-reserved","likes_count":0,"permalink":"dubstep-mini-set","permalink_url":"https://soundcloud.com/sterobeatpower/dubstep-mini-set","playback_count":32,"public":true,"publisher_metadata":null,"purchase_title":null,"purchase_url":null,"release_date":null,"reposts_count":0,"secret_token":null,"sharing":"public","state":"finished","streamable":true,"tag_list":"","title":"Dubstep Mini-Set","track_format":"single-track","uri":"https://api.soundcloud.com/tracks/19832987","urn":"soundcloud:tracks:19832987","user_id":6150091,"visuals":null,"waveform_url":"https://wave.sndcdn.com/Bo8blngYQj7D_m.json","display_date":"2011-07-26T19:42:15Z","media":{"transcodings":[{"url":"https://api-v2.soundcloud.com/media/soundcloud:tracks:19832987/6241eb8c-73f4-4908-9095-910501c83d5b/stream/hls","preset":"mp3_0_0","duration":1510791,"snipped":false,"format":{"protocol":"hls","mime_type":"audio/mpeg"},"quality":"sq"},{"url":"https://api-v2.soundcloud.com/media/soundcloud:tracks:19832987/6241eb8c-73f4-4908-9095-910501c83d5b/stream/progressive","preset":"mp3_0_0","duration":1510791,"snipped":false,"format":{"protocol":"progressive","mime_type":"audio/mpeg"},"quality":"sq"}]},"station_urn":"soundcloud:system-playlists:track-stations:19832987","station_permalink":"track-stations:19832987","track_authorization":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJnZW8iOiJJTiIsInN1YiI6Ijk1NDI1MTAxNCIsInJpZCI6IiIsImlhdCI6MTY3NjQ3NjQ2NX0.2vlntxFo_r9ZLXPcltccR2hZIQ68iQ_zTkdNSCCoqVc","monetization_model":"NOT_APPLICABLE","policy":"ALLOW","user":{"avatar_url":"https://i1.sndcdn.com/avatars-000004930090-at22yw-large.jpg","first_name":"Pedro","followers_count":0,"full_name":"Pedro Santos","id":6150091,"kind":"user","last_modified":"2012-01-18T03:24:00Z","last_name":"Santos","permalink":"sterobeatpower","permalink_url":"https://soundcloud.com/sterobeatpower","uri":"https://api.soundcloud.com/users/6150091","urn":"soundcloud:users:6150091","username":"SteroBeatPower","verified":false,"city":"Caldas da Rainha","country_code":"PT","badges":{"pro":false,"pro_unlimited":false,"verified":false},"station_urn":"soundcloud:system-playlists:artist-stations:6150091","station_permalink":"artist-stations:6150091"}}},{"played_at":1676469026426,"track_id":294237507,"track":{"artwork_url":"https://i1.sndcdn.com/artworks-000194791064-618wb2-large.jpg","caption":null,"commentable":true,"comment_count":3911,"created_at":"2016-11-22T13:05:32Z","description":"Discover the best Melodic Deep House to Techno with us ! From Paris with Love <3\n\nGiorgia Angiuli - Embrace Me Now\n\nOur favourite little Italian girl can't stop surprising us! And something tells me that this is just the beginning! To thank everyone supporting her, she has decided to offer her track \"Embrace me now\" as a free download. It's a track that has been heard all over the world, from New York to Taiwan and which now has almost 2 millions views on Facebook! She honours us by choosing Sweet Melodic as the place to offer this gift and spoils us at the same time. Giorgia, thank you. <3\n\nFollow the artist here :\nhttps://soundcloud.com/giorgiaangiuli-1\nhttps://www.facebook.com/giorgia.angiuli/\n\nALL PREMIERE SWEET MELODIC :\u000Bsoundcloud.com/sweetmelodicmusic/sets/sweetmelodicpremiere\n\nALL FREE DOWNLOAD SWEET MELODIC :\u000Bsoundcloud.com/sweetmelodicmusic/sets/sweet-melodic-free-download-1","downloadable":false,"download_count":1,"duration":343176,"full_duration":343176,"embeddable_by":"all","genre":"Melodic Techno","has_downloads_left":false,"id":294237507,"kind":"track","label_name":null,"last_modified":"2022-05-21T07:14:52Z","license":"all-rights-reserved","likes_count":22762,"permalink":"free-download-giorgia-angiuli-embrace-me-now","permalink_url":"https://soundcloud.com/sweetmusicofc/free-download-giorgia-angiuli-embrace-me-now","playback_count":657542,"public":true,"publisher_metadata":{"id":294237507,"urn":"soundcloud:tracks:294237507","artist":"Giorgia Angiuli","contains_music":true,"isrc":"QM8DG1810859"},"purchase_title":null,"purchase_url":null,"release_date":null,"reposts_count":4052,"secret_token":null,"sharing":"public","state":"finished","streamable":true,"tag_list":"","title":"Giorgia Angiuli - Embrace Me Now","track_format":"single-track","uri":"https://api.soundcloud.com/tracks/294237507","urn":"soundcloud:tracks:294237507","user_id":56859432,"visuals":null,"waveform_url":"https://wave.sndcdn.com/onkOFwlRT8iF_m.json","display_date":"2016-11-22T13:05:32Z","media":{"transcodings":[{"url":"https://api-v2.soundcloud.com/media/soundcloud:tracks:294237507/d639b16a-5377-4f71-b16e-c50a51e150b9/stream/hls","preset":"mp3_0_0","duration":343176,"snipped":false,"format":{"protocol":"hls","mime_type":"audio/mpeg"},"quality":"sq"},{"url":"https://api-v2.soundcloud.com/media/soundcloud:tracks:294237507/d639b16a-5377-4f71-b16e-c50a51e150b9/stream/progressive","preset":"mp3_0_0","duration":343176,"snipped":false,"format":{"protocol":"progressive","mime_type":"audio/mpeg"},"quality":"sq"},{"url":"https://api-v2.soundcloud.com/media/soundcloud:tracks:294237507/d641c29d-087f-4496-b9c1-850e50c7e6ff/stream/hls","preset":"opus_0_0","duration":343176,"snipped":false,"format":{"protocol":"hls","mime_type":"audio/ogg; codecs=\"opus\""},"quality":"sq"}]},"station_urn":"soundcloud:system-playlists:track-stations:294237507","station_permalink":"track-stations:294237507","track_authorization":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJnZW8iOiJJTiIsInN1YiI6Ijk1NDI1MTAxNCIsInJpZCI6ImJkZmRhYmZmLWEzMjctNDBkMS04MTA0LTE5ODJkZTFkM2Y4ZSIsImlhdCI6MTY3NjQ3NjQ2NX0.XbdbOMCRSSihz5Unxn65bhMKuZr850vBS4yvQBFEaLM","monetization_model":"NOT_APPLICABLE","policy":"ALLOW","user":{"avatar_url":"https://i1.sndcdn.com/avatars-tuWPsz6Lr9J1PpYU-4xWBeA-large.jpg","first_name":"www.sweetmusic.fr","followers_count":140980,"full_name":"www.sweetmusic.fr","id":56859432,"kind":"user","last_modified":"2023-01-26T10:55:14Z","last_name":"","permalink":"sweetmusicofc","permalink_url":"https://soundcloud.com/sweetmusicofc","uri":"https://api.soundcloud.com/users/56859432","urn":"soundcloud:users:56859432","username":"Sweet Music","verified":true,"city":"","country_code":null,"badges":{"pro":false,"pro_unlimited":true,"verified":true},"station_urn":"soundcloud:system-playlists:artist-stations:56859432","station_permalink":"artist-stations:56859432"}}},"next_href":"https://api-v2.soundcloud.com/me/play-history/tracks?offset=3851489666&from=1676474437536&limit=25","query_urn":null}

So It appears that a Combo of ListRequest & CollectionRequest is needed and a new Data Structure (@dataclass)

Please check my fork and help me

CosmicSage avatar Feb 15 '23 18:02 CosmicSage

Yo I added A PR #6 for this feature request it works well and is quite non-ivasive to entire codebsae I like it hope you like it too

CosmicSage avatar Feb 16 '23 15:02 CosmicSage