[GH-ISSUE #14] [Feature Request] LastFM Integration / History API #10

Closed
opened 2026-02-27 22:07:33 +03:00 by kerem · 3 comments
Owner

Originally created by @akraus53 on GitHub (May 15, 2020).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/14

Hi All,

I would like to request a feature, which is actually something I've been trying to do with google play music for the last few weeks on and off but couldn't get to work. With Google explaining how to switch to Youtube Music recently, I might as well try getting it to work on YT-music.

I want to log my listening history on LastFM, which is a platform to do exactly that, they call it "scrobbling". I'd be happy to write my own software to do the scrobbling part, but I think this could be a usefull tool for many. Scrobbling is mainly done by reading notifications or by native integration in a player, which is both impossible if you're using a Smart Home Speaker like Chromecast Audio or a Google Home Mini.

Therefore, I'd prefer scrobbling the history from https://music.youtube.com/history

So a feature like ytmusic.get_history(someUnixTimestamp) would be awesome and ytmusic.autoScrobble() would be even better.

I might look into this myself, but hell, feel free to implement it yourself.

Thanks a lot

Originally created by @akraus53 on GitHub (May 15, 2020). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/14 ### Hi All, I would like to request a feature, which is actually something I've been trying to do with google play music for the last few weeks on and off but couldn't get to work. With Google [explaining how to switch to Youtube Music ](https://www.youtube.com/watch?v=gPWl7eKe6lY) recently, I might as well try getting it to work on YT-music. I want to log my listening history on LastFM, which is a platform to do exactly that, they call it "scrobbling". I'd be happy to write my own software to do the scrobbling part, but I think this could be a usefull tool for many. Scrobbling is mainly done by reading notifications or by native integration in a player, which is both impossible if you're using a Smart Home Speaker like Chromecast Audio or a Google Home Mini. **Therefore, I'd prefer scrobbling the history from https://music.youtube.com/history** So a feature like `ytmusic.get_history(someUnixTimestamp)` would be awesome and `ytmusic.autoScrobble()` would be even better. I might look into this myself, but hell, feel free to implement it yourself. Thanks a lot
kerem 2026-02-27 22:07:33 +03:00
Author
Owner

@sigma67 commented on GitHub (May 15, 2020):

Hey, thanks for the interesting suggestions. Have you checked the get_history method? I think it should provide all the information you need.

A valuable enhancement to that method could be adding a unix timestamp to each entry. Unfortunately YouTube does not provide the exact timestamp. Currently ytmusicapi is parsing the section headings you can see on the page. Those could be converted to the corresponding days at UTC+00 00:00.

For scrobbling while playing, you can use the YTMusic integration of the unofficial desktop player. It scrobbles your YTMusic tracks while playing.

I'm not sure how autoScrobble() would work. I guess you could retrieve the history page in regular intervals and scrobble new items to Last.FM. But I think that would be something a project using ytmusicapi as a dependency could implement.

<!-- gh-comment-id:629204205 --> @sigma67 commented on GitHub (May 15, 2020): Hey, thanks for the interesting suggestions. Have you checked the [`get_history`](https://ytmusicapi.readthedocs.io/en/latest/reference.html?highlight=get_history#ytmusicapi.YTMusic.get_history) method? I think it should provide all the information you need. A valuable enhancement to that method could be adding a unix timestamp to each entry. Unfortunately YouTube does not provide the exact timestamp. Currently ytmusicapi is parsing the section headings you can see on the page. Those could be converted to the corresponding days at UTC+00 00:00. For scrobbling while playing, you can use the YTMusic integration of the [unofficial desktop player](https://github.com/MarshallOfSound/Google-Play-Music-Desktop-Player-UNOFFICIAL-). It scrobbles your YTMusic tracks while playing. I'm not sure how `autoScrobble()` would work. I guess you could retrieve the history page in regular intervals and scrobble new items to Last.FM. But I think that would be something a project using ytmusicapi as a dependency could implement.
Author
Owner

@akraus53 commented on GitHub (May 15, 2020):

Thank you very much. I didn't see that that function already exists. This is the equivalent of calling tech support without trying to turn it off and on again...

<!-- gh-comment-id:629212118 --> @akraus53 commented on GitHub (May 15, 2020): Thank you very much. I didn't see that that function already exists. This is the equivalent of calling tech support without trying to turn it off and on again...
Author
Owner

@akraus53 commented on GitHub (May 15, 2020):

Feel free to reopen if you want to, I'm fine with this being fixed for now 🎧

<!-- gh-comment-id:629212554 --> @akraus53 commented on GitHub (May 15, 2020): Feel free to reopen if you want to, I'm fine with this being fixed for now 🎧
Sign in to join this conversation.
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/ytmusicapi#10
No description provided.