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

Get artist top tracks #47

Closed
Epic-R-R opened this issue Jan 9, 2023 · 4 comments · Fixed by #56
Closed

Get artist top tracks #47

Epic-R-R opened this issue Jan 9, 2023 · 4 comments · Fixed by #56

Comments

@Epic-R-R
Copy link

Epic-R-R commented Jan 9, 2023

I use this artist_id 1304716885 for get details from artist and it work fine
but when I want to get top track from this artist it show me error
shazamio.exceptions.FailedDecodeJson: Check args, URL is invalid URL- https://cdn.shazam.com/shazam/v3/en/GB/web/-/tracks/artisttoptracks_1304716885?startFrom=0&pageSize=3&connected=&channel=
I use this artist_id 201896832 you put in the example file and it works but for another artist, it gives an error

@Epic-R-R
Copy link
Author

Epic-R-R commented Jan 9, 2023

It also gives me an error when I use the top track country code method
shazamio.exceptions.FailedDecodeJson: Check args, URL is invalid URL- https://www.shazam.com/shazam/v3/en/GB/web/-/tracks/ip-country-chart-?pageSize=200&startFrom=0

@Daxitdon
Copy link
Contributor

Daxitdon commented May 4, 2023

i am also getting same error

dotX12 added a commit that referenced this issue May 5, 2023
dotX12 added a commit that referenced this issue May 5, 2023
@dotX12
Copy link
Collaborator

dotX12 commented May 5, 2023

Hello @Epic-R-R, @Daxitdon.
Sorry for such a long wait for this issue.
artisttoptracks is deprecated.

Now syntax:

import asyncio
from shazamio import Shazam, Serialize
from shazamio.schemas.artists import ArtistQuery
from shazamio.schemas.enums import ArtistView


async def main():
    shazam = Shazam()
    artist_id = 1081606072

    about_artist = await shazam.artist_about(
        artist_id,
        query=ArtistQuery(
            views=[
                ArtistView.TOP_SONGS,
            ],
        ),
    )
    serialized = Serialize.artist_v2(about_artist)
    for i in serialized.data[0].views.top_songs.data:
        print(i.attributes.name)


loop = asyncio.get_event_loop_policy().get_event_loop()
loop.run_until_complete(main())

Result:

'...And to Those I Love, Thanks for Sticking Around'
'Kill Yourself (Part III)'
'Paris'
'2nd Hand'
'$Outh $Ide $Uicide (feat. Pouya)'
'Carrollton'
'122 Days'
'O Pana!'
'For the Last Time'
"Runnin' Thru the 7th with My Woadies"

Web:

image

@dotX12 dotX12 mentioned this issue May 5, 2023
@dotX12 dotX12 closed this as completed in #56 May 5, 2023
@dotX12 dotX12 mentioned this issue May 5, 2023
@dotX12
Copy link
Collaborator

dotX12 commented May 5, 2023

Released: https://pypi.org/project/shazamio/0.4.0.0/

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 a pull request may close this issue.

3 participants