marhoy / nrk-download

Download content from NRK, complete with images and subtitles:
https://nrkdownload.readthedocs.org
GNU General Public License v3.0
54 stars 10 forks source link

List index out of range #14

Closed Danielv123 closed 4 years ago

Danielv123 commented 4 years ago

Describe the bug Unable to download recent seasons of Mesternes Mester

To Reproduce Steps to reproduce the behavior:

  1. Run nrkdownload -d . -a https://tv.nrk.no/serie/mesternes-mester/sesong/10/episode/1/avspiller

  2. See error Traceback (most recent call last): File "/home/danielv/.local/bin/nrkdownload", line 11, in <module> sys.exit(main()) File "/home/danielv/.local/lib/python2.7/site-packages/nrkdownload/commandline_script.py", line 80, in main download_url(url, download_all=arguments.all, download_last=arguments.last) File "/home/danielv/.local/lib/python2.7/site-packages/nrkdownload/commandline_script.py", line 95, in download_url programs = parse_nrk_url.parse_url(url) File "/home/danielv/.local/lib/python2.7/site-packages/nrkdownload/parse_nrk_url.py", line 92, in parse_url episode = series.seasons[season_number - 1].episodes[episode_number - 1] IndexError: list index out of range Expected behavior Episode starts downloading

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

This issue happens for anything past halfway through season 4 for this show.

marhoy commented 4 years ago

OK, I've identified the problem: Only the last 4 seasons of this series is available online. But the code stores the seasons as a list and indexes that list by season number. So the length of the list is only 4, but the index (season) is 11. I think one solution would be to rewrite using a dictionary instead (maybe using the season-ids as keys), such that you can look up any season no matter how many are available.

marhoy commented 4 years ago

New release available from pypi.org, please update and try again.

Danielv123 commented 4 years ago

Works perfectly, thanks a lot! Will have to go through cleaning up all the mislabeled downloads now.