aajanki / yle-dl

Download videos from Yle servers
https://aajanki.github.io/yle-dl/index-en.html
GNU General Public License v3.0
310 stars 51 forks source link

Feaeture request: Add Yle Areena id code to the filename, batch download an Yle Areena page with videos/"podcasts". #364

Closed joonas-foo closed 2 months ago

joonas-foo commented 3 months ago

Hi and thanks for the excellent program! I've these two suggestions, add Yle Areena id code to the filename so they're more easily identifable, the same way yt-dlp does.

Second feature request is a batch download function to download an Yle Areena page of videos or "podcasts", download all the programs on that page.

aajanki commented 3 months ago

You can add the ID on the filename using the --output-template command line switch. For example: yle-dl --output-template '${program_id}' https://areena.yle.fi/1-1621050. See yle-dl --help for documentation about possible output-template options.

yle-dl should download all episodes on a web page. There are a few pages where batch downloading doesn't currently work. If you encountered a page whereyle-dl doesn't download all episodes, can you post the address of the page?

DarrenPIngram commented 3 months ago

https://areena.yle.fi/tv/ohjelmat/57-E0Ab1xxkY is an exception to bulk downloading.

yle-dl "https://areena.yle.fi/tv/ohjelmat/57-E0Ab1xxkY"
yle-dl 20240429: Download media files from Yle Areena and Elävä Arkisto
Copyright (C) 2009-2024 Antti Ajanki <antti.ajanki@iki.fi>, license: GPLv3

Traceback (most recent call last):
  File "/opt/homebrew/bin/yle-dl", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/Cellar/yle-dl/20240429_2/libexec/lib/python3.12/site-packages/yledl/yledl.py", line 514, in main
    res = execute_action(
          ^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/yle-dl/20240429_2/libexec/lib/python3.12/site-packages/yledl/yledl.py", line 317, in execute_action
    return dl.download_clips(url, io, stream_filters)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/yle-dl/20240429_2/libexec/lib/python3.12/site-packages/yledl/downloader.py", line 71, in download_clips
    res = self.download_with_retry(
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/yle-dl/20240429_2/libexec/lib/python3.12/site-packages/yledl/downloader.py", line 153, in download_with_retry
    clip = extractor.extract_clip(clip_url, base_url)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/yle-dl/20240429_2/libexec/lib/python3.12/site-packages/yledl/extractors.py", line 707, in extract_clip
    program_info = self.program_info_for_pid(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/yle-dl/20240429_2/libexec/lib/python3.12/site-packages/yledl/extractors.py", line 904, in program_info_for_pid
    preview = self.preview_parser(pid, pageurl)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/yle-dl/20240429_2/libexec/lib/python3.12/site-packages/yledl/extractors.py", line 953, in preview_parser
    preview_json = self.httpclient.download_json(url, preview_headers)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/yle-dl/20240429_2/libexec/lib/python3.12/site-packages/yledl/http.py", line 65, in download_json
    response = self.get(url, extra_headers)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/yle-dl/20240429_2/libexec/lib/python3.12/site-packages/yledl/http.py", line 112, in get
    r.raise_for_status()
  File "/opt/homebrew/Cellar/yle-dl/20240429_2/libexec/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://player.api.yle.fi/v1/preview/57-E0Ab1xxkY.json?language=fin&ssl=true&countryCode=FI&host=areenaylefi&app_id=player_static_prod&app_key=8930d72170e48303cf5f3867780d549b&isPortabilityRegion=true
aajanki commented 2 months ago

This is now fixed on the master branch.