[GH-ISSUE #8] Add JSON Extraction Functionality for Tracks, Albums, and Playlists #61

Closed
opened 2026-03-01 17:50:01 +03:00 by kerem · 9 comments
Owner

Originally created by @afkarxyz on GitHub (Dec 7, 2024).
Original GitHub issue: https://github.com/Aran404/SpotAPI/issues/8

Hi, could you add functionality to extract JSON files for tracks, albums, and playlists?

Originally created by @afkarxyz on GitHub (Dec 7, 2024). Original GitHub issue: https://github.com/Aran404/SpotAPI/issues/8 Hi, could you add functionality to extract JSON files for tracks, albums, and playlists?
kerem closed this issue 2026-03-01 17:50:02 +03:00
Author
Owner

@Aran404 commented on GitHub (Dec 8, 2024):

Could you elaborate please?

<!-- gh-comment-id:2525452846 --> @Aran404 commented on GitHub (Dec 8, 2024): Could you elaborate please?
Author
Owner

@afkarxyz commented on GitHub (Dec 8, 2024):

image

"I've tested it for playlists, and it works, but for albums and tracks, it seems like they are not mentioned in the README.

I tested using the following methods:

import json
from spotapi import PublicAlbum

def get_album_raw_json(album_url):
    album = PublicAlbum(album_url)
    return album.get_album_info()

album_url = "https://open.spotify.com/album/2noRn2Aes5aoNVsU6iv3c0"
raw_json = get_album_raw_json(album_url)
print(json.dumps(raw_json, indent=2))

or

import json
from spotapi import PublicTrack

def get_track_raw_json(track_url):
    track = PublicTrack(track_url)
    return track.get_track_info()

track_url = "https://open.spotify.com/track/0WbMK4wrZ1wFSty9F7FCgu"
raw_json = get_track_raw_json(track_url)
print(json.dumps(raw_json, indent=2))

but I encountered an error."

  • ImportError: cannot import name 'PublicAlbum' from 'spotapi'
  • ImportError: cannot import name 'PublicTrack' from 'spotapi'
<!-- gh-comment-id:2525455755 --> @afkarxyz commented on GitHub (Dec 8, 2024): ![image](https://github.com/user-attachments/assets/bedc0b08-e4fa-4656-9690-ff6cc60d260c) "I've tested it for playlists, and it works, but for albums and tracks, it seems like they are not mentioned in the README. I tested using the following methods: ```python import json from spotapi import PublicAlbum def get_album_raw_json(album_url): album = PublicAlbum(album_url) return album.get_album_info() album_url = "https://open.spotify.com/album/2noRn2Aes5aoNVsU6iv3c0" raw_json = get_album_raw_json(album_url) print(json.dumps(raw_json, indent=2)) ``` or ```python import json from spotapi import PublicTrack def get_track_raw_json(track_url): track = PublicTrack(track_url) return track.get_track_info() track_url = "https://open.spotify.com/track/0WbMK4wrZ1wFSty9F7FCgu" raw_json = get_track_raw_json(track_url) print(json.dumps(raw_json, indent=2)) ``` but I encountered an error." - ImportError: cannot import name 'PublicAlbum' from 'spotapi' - ImportError: cannot import name 'PublicTrack' from 'spotapi'
Author
Owner

@Aran404 commented on GitHub (Dec 8, 2024):

I'll put this in my todo. Thanks.

<!-- gh-comment-id:2526202466 --> @Aran404 commented on GitHub (Dec 8, 2024): I'll put this in my todo. Thanks.
Author
Owner

@afkarxyz commented on GitHub (Dec 8, 2024):

Thanks! Looking forward to the updates.

<!-- gh-comment-id:2526204590 --> @afkarxyz commented on GitHub (Dec 8, 2024): Thanks! Looking forward to the updates.
Author
Owner

@Aran404 commented on GitHub (Dec 10, 2024):

I've added the suggestions, have a look at let me know if any issues arises. Thanks again.

<!-- gh-comment-id:2529963073 --> @Aran404 commented on GitHub (Dec 10, 2024): I've added the suggestions, have a look at let me know if any issues arises. Thanks again.
Author
Owner

@afkarxyz commented on GitHub (Dec 10, 2024):

I checked in branches and pypi.org there is no update, where did you add it?

<!-- gh-comment-id:2530138883 --> @afkarxyz commented on GitHub (Dec 10, 2024): I checked in branches and pypi.org there is no update, where did you add it?
Author
Owner

@Aran404 commented on GitHub (Dec 10, 2024):

Seems I somehow didn't push it, will do that tomorrow. I think it has something to do with the new MFA mandate

<!-- gh-comment-id:2530219603 --> @Aran404 commented on GitHub (Dec 10, 2024): Seems I somehow didn't push it, will do that tomorrow. I think it has something to do with the new MFA mandate
Author
Owner

@Aran404 commented on GitHub (Dec 10, 2024):

Should be good now.

<!-- gh-comment-id:2533231293 --> @Aran404 commented on GitHub (Dec 10, 2024): Should be good now.
Author
Owner

@afkarxyz commented on GitHub (Dec 11, 2024):

Thank you so much for the update; everything is working like a charm now. 👍

<!-- gh-comment-id:2533343855 --> @afkarxyz commented on GitHub (Dec 11, 2024): Thank you so much for the update; everything is working like a charm now. 👍
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SpotAPI#61
No description provided.