mirror of
https://github.com/sigma67/ytmusicapi.git
synced 2026-04-25 23:36:00 +03:00
[GH-ISSUE #186] Get resource from link #143
Labels
No labels
a/b
bug
documentation
enhancement
good first issue
help wanted
invalid
pull-request
question
wontfix
yt-error
yt-update
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ytmusicapi#143
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nickpwhite on GitHub (Apr 3, 2021).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/186
Hi there,
I have a use case that involves looking up information about a resource given it's "share" link (accessible from Share under the 3 dots menu). For songs this is easy, since their share link looks something like this: https://music.youtube.com/watch?v=noez-N3GwU8&feature=share and I can use the video ID (the value of the v query param) to look up the song using the get_song function.
On the other hand, albums have links that look like this: https://music.youtube.com/playlist?list=OLAK5uy_nu7bYOOPMVusryrM-q09vOKZzhVFlDICw&feature=share and the value of the list query param doesn't appear to be a browse id, and it doesn't work if I pass it into the get_album function. I also tried passing it to the get_playlist function and got a different error, I think the response coming back from the initial request is not the right shape.
the response looks like this:
This error and response are from the current master. I haven't been able to get this work on the latest release (0.15.0) either.
Does the package currently provide a way to accomplish my goal here? If not, do you think that it's doable and in scope for this package? I'm happy to contribute PRs if you're open to it.
@sigma67 commented on GitHub (Apr 3, 2021):
It seems like it's just the audioPlaylistId?
@nickpwhite commented on GitHub (Apr 4, 2021):
That looks right, I was able to get a usable response using:
Using the list of tracks there I could pull the album browseId to get more information about the album through the get_album function.
Thanks for the help! I'll close this issue.
@sigma67 commented on GitHub (Apr 5, 2021):
I think it's actually possible to get the browseId from the audioPlaylistId with a single GET request. If you open the share link in the browser with the audioPlaylistId you get redirected to the correct page, since the request returns the browseId of the album. Could be implemented as a separate function in ytmusicapi.
@nickpwhite commented on GitHub (Apr 5, 2021):
That's great, thank you! Here's an example of this function in action: https://github.com/nickpwhite/Beatnik/pull/28