sigma67/ytmusicapi

get_playlist fails if some track has invalid duration_seconds

adwait-thattey opened this issue · 0 comments

Describe the bug
Some tracks in Yt music can have invalid entry for field duration_seconds. I typically saw this with unavailable tracks (that were live radios, but now removed) but maybe others can have similar issue. See attached sample json for the track below.

Due to this, if a playlist contains such tracks and we call get_playlist , the internal helper function sum_total_duration fails because duration_seconds is not an int.
See screenshot for failure below

2 sample tracks with invalid duration_seconds entry:
image
image

Sample track in my playlist
image

Error when get_playlist is called
image

To Reproduce
Steps to reproduce the behavior:

  1. Have a playlist with a track that has invalid duration_seconds
  2. call get_playlist on the playlist
  3. See error

Fix
I have fixed this locally. Submitting a PR