sigma67 / ytmusicapi

Unofficial API for YouTube Music
https://ytmusicapi.readthedocs.io
MIT License
1.76k stars 209 forks source link

Added Lyrics w. Timestamps #662

Open heinrich26 opened 1 month ago

heinrich26 commented 1 month ago

Added get_lyrics_with_timestamps to get lyrics with timestamps. The Method doesn't try to parse the response as normal lyrics, if no lyrics with timestamps are returned. (could be changed to do so tho, the format is the same)

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 97.61905% with 2 lines in your changes missing coverage. Please review.

Project coverage is 94.99%. Comparing base (2b5d19a) to head (a8a1f5f). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
ytmusicapi/mixins/browsing.py 92.85% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #662 +/- ## ========================================== - Coverage 94.99% 94.99% -0.01% ========================================== Files 38 40 +2 Lines 2278 2337 +59 ========================================== + Hits 2164 2220 +56 - Misses 114 117 +3 ``` | [Flag](https://app.codecov.io/gh/sigma67/ytmusicapi/pull/662/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sigma67) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/sigma67/ytmusicapi/pull/662/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sigma67) | `94.99% <97.61%> (-0.01%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sigma67#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

heinrich26 commented 1 month ago

Yea, calling the API "as a different frontend" gives you different results. I temporarily changed the client because I thought unforeseen side-effects aren't desirable.As per the implementation of a multipurpose get_lyrics(), I would add an argument like timestamps=True/False, to keep it backwards compatible and allow the user to always get the same (old) format – with my approach, you'll end up with 2 possible formats.Furthermore, would you keep the original format with the nested CueRange or would you rather have a flat dict? I think that nesting is kinda useless.

heinrich26 commented 1 month ago

finally used pre-commit to fix those formatting complaints 🤷‍♂️