Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for minor Soundcloud API change breaking the entire library #7

Merged
merged 1 commit into from
Mar 20, 2024
Merged

Fix for minor Soundcloud API change breaking the entire library #7

merged 1 commit into from
Mar 20, 2024

Conversation

aprilsbloom
Copy link
Contributor

Hi,
Unsure if this is something on my end or not but whenever attempting to create a new instance of the SoundCloud class it errors. In the client ID validation you make a request for a track, but its trying to create a dataclass with a property the Soundcloud API doesn't seem to return anymore for the result (note the track_format part of the error). This simply removes that property as they don't seem to return it anymore. Probably a better way of doing this, i.e. marking the property as optional, but your call

cmd_WjB8GRiPyL

Example response as of 20/03/24

{
    "artwork_url": null,
    "caption": null,
    "commentable": true,
    "comment_count": 6,
    "created_at": "2021-04-19T04:42:01Z",
    "description": "part 1 ends at 3:46",
    "downloadable": true,
    "download_count": 48,
    "duration": 673071,
    "full_duration": 673071,
    "embeddable_by": "all",
    "genre": "Electronic",
    "has_downloads_left": true,
    "id": 1032303631,
    "kind": "track",
    "label_name": null,
    "last_modified": "2021-10-07T06:29:07Z",
    "license": "all-rights-reserved",
    "likes_count": 57,
    "permalink": "wan-bushi-eurodance-vibes-part-123",
    "permalink_url": "https://soundcloud.com/7x11x13/wan-bushi-eurodance-vibes-part-123",
    "playback_count": 1065,
    "public": true,
    "publisher_metadata": {
        "id": 1032303631,
        "urn": "soundcloud:tracks:1032303631",
        "artist": "Wan Bushi",
        "contains_music": true
    },
    "purchase_title": null,
    "purchase_url": null,
    "release_date": null,
    "reposts_count": 2,
    "secret_token": null,
    "sharing": "public",
    "state": "finished",
    "streamable": true,
    "tag_list": "\"Wan Bushi\"",
    "title": "Wan Bushi - Eurodance Vibes (part 1+2+3)",
    "uri": "https://api.soundcloud.com/tracks/1032303631",
    "urn": "soundcloud:tracks:1032303631",
    "user_id": 790976431,
    "visuals": null,
    "waveform_url": "https://wave.sndcdn.com/TmINiENWxXHq_m.json",
    "display_date": "2021-04-19T06:21:38Z",
    "media": {
        "transcodings": [
            {
                "url": "https://api-v2.soundcloud.com/media/soundcloud:tracks:1032303631/67c6e3c2-ee14-406e-8aa0-39093726e4ef/stream/hls",
                "preset": "mp3_0_1",
                "duration": 673071,
                "snipped": false,
                "format": {
                    "protocol": "hls",
                    "mime_type": "audio/mpeg"
                },
                "quality": "sq"
            },
            {
                "url": "https://api-v2.soundcloud.com/media/soundcloud:tracks:1032303631/67c6e3c2-ee14-406e-8aa0-39093726e4ef/stream/progressive",
                "preset": "mp3_0_1",
                "duration": 673071,
                "snipped": false,
                "format": {
                    "protocol": "progressive",
                    "mime_type": "audio/mpeg"
                },
                "quality": "sq"
            },
            {
                "url": "https://api-v2.soundcloud.com/media/soundcloud:tracks:1032303631/0bac1826-d38b-4197-9101-304ec3950d50/stream/hls",
                "preset": "opus_0_0",
                "duration": 673039,
                "snipped": false,
                "format": {
                    "protocol": "hls",
                    "mime_type": "audio/ogg; codecs=\"opus\""
                },
                "quality": "sq"
            }
        ]
    },
    "station_urn": "soundcloud:system-playlists:track-stations:1032303631",
    "station_permalink": "track-stations:1032303631",
    "track_authorization": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJnZW8iOiJOWiIsInN1YiI6IiIsInJpZCI6IiIsImlhdCI6MTcxMDkyODUyNn0.gs1B-OhpCHNfiYCk0Sgr9Zd1MfYte_mJbzVlfEfYPo4",
    "monetization_model": "NOT_APPLICABLE",
    "policy": "ALLOW",
    "user": {
        "avatar_url": "https://i1.sndcdn.com/avatars-iCvxUcMwOpJWJnzH-jqr8TA-large.jpg",
        "first_name": "",
        "followers_count": 452,
        "full_name": "",
        "id": 790976431,
        "kind": "user",
        "last_modified": "2021-10-17T02:21:15Z",
        "last_name": "",
        "permalink": "7x11x13",
        "permalink_url": "https://soundcloud.com/7x11x13",
        "uri": "https://api.soundcloud.com/users/790976431",
        "urn": "soundcloud:users:790976431",
        "username": "7x11x13",
        "verified": false,
        "city": "",
        "country_code": null,
        "badges": {
            "pro": false,
            "pro_unlimited": false,
            "verified": false
        },
        "station_urn": "soundcloud:system-playlists:artist-stations:790976431",
        "station_permalink": "artist-stations:790976431"
    }
}

@7x11x13 7x11x13 merged commit 26e37d4 into 7x11x13:main Mar 20, 2024
1 of 2 checks passed
@7x11x13
Copy link
Owner

7x11x13 commented Mar 20, 2024

Looks like SoundCloud has been working on their internal API recently, may be more breaking changes in the near future. Thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants