yt-dlp / yt-dlp

A feature-rich command-line audio/video downloader
https://discord.gg/H5MNcFW63r
The Unlicense
76.75k stars 6.03k forks source link

[Radiko] ERROR: 'int' object has no attribute 'decode' #8333

Closed rubyevadestaxes closed 9 months ago

rubyevadestaxes commented 9 months ago

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

Checklist

Region

Japan

Provide a description that is worded well enough to be understood

yt-dlp breaks when trying to download from Radiko with the error: 'int' object has no attribute 'decode' The page is only accessible from Japan.

Command used: yt-dlp 'https://radiko.jp/#!/ts/LFR/20231010022853' -v --update

Provide verbose output that clearly demonstrates the problem

Complete Verbose Output

[debug] Command-line config: ['https://radiko.jp/#!/ts/LFR/20231010022853', '-v', '--update']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.10.07 [377e85a17] (zip)
[debug] Python 3.11.5 (CPython x86_64 64bit) - Linux-6.5.6-arch2-1-x86_64-with-glibc2.38 (OpenSSL 3.1.3 19 Sep 2023, glibc 2.38)
[debug] exe versions: ffmpeg 6.0 (setts), ffprobe 6.0, rtmpdump 2.4
[debug] Optional libraries: pycrypto-3.19.0, sqlite3-3.43.1
[debug] Proxy map: {}
[debug] Loaded 1886 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Available version: stable@2023.10.07, Current version: stable@2023.10.07
Current Build Hash: 47743cde1f66f16f8ef8440b78171877122b1277f906dbebfb7d49fb4c64ab0b
yt-dlp is up to date (stable@2023.10.07)
[Radiko] Extracting URL: https://radiko.jp/#!/ts/LFR/20231010022853
[Radiko] 20231010022853: Downloading radio program for LFR station
[debug] Loading radiko.auth_data from cache
[Radiko] Checking cached token
[Radiko] Downloading authentication page
[Radiko] Downloading player js code
[Radiko] Authenticating
[debug] Saving radiko.auth_data to cache
[Radiko] 20231010022853: Downloading stream information
[Radiko] 20231010022853: Downloading m3u8 information from tf-f-rpaa-radiko.smartstream.ne.jp
[Radiko] 20231010022853: Downloading m3u8 information from tf-c-rpaa-radiko.smartstream.ne.jp
[Radiko] 20231010022853: Downloading m3u8 information from rd-wowza-radiko.radiko-cf.com
[Radiko] 20231010022853: Downloading m3u8 information from radiko.jp
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: best/bestvideo+bestaudio
[info] 20231010022853: Downloading 1 format(s): rd-wowza-radiko.radiko-cf.com
[debug] Invoking ffmpeg downloader on "https://rd-wowza-radiko.radiko-cf.com/medialist?session=7saahb5uTGe6cYFRxDT436&station_id=LFR"
[download] Destination: Adoのオールナイトニッポン 2023-10-12 18_20 [20231010022853].m4a
ERROR: 'int' object has no attribute 'decode'
Traceback (most recent call last):
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1567, in wrapper
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1723, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1782, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2921, in process_video_result
    self.process_info(new_info)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 3387, in process_info
    success, real_download = self.dl(temp_filename, info_dict)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 3108, in dl
    return fd.download(name, new_info, subtitle)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/yt-dlp/yt_dlp/downloader/common.py", line 455, in download
    ret = self.real_download(filename, info_dict)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/yt-dlp/yt_dlp/downloader/external.py", line 50, in real_download
    retval = self._call_downloader(tmpfilename, info_dict)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/yt-dlp/yt_dlp/downloader/external.py", line 620, in _call_downloader
    args = [encodeArgument(opt) for opt in args]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/yt-dlp/yt_dlp/downloader/external.py", line 620, in <listcomp>
    args = [encodeArgument(opt) for opt in args]
            ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/yt-dlp/yt_dlp/utils/_utils.py", line 878, in encodeArgument
AttributeError: 'int' object has no attribute 'decode'
bashonly commented 9 months ago

Looks like a bug that's been present since the extractor was added (1931a55ee8412ee385357f33128996cc3d07560e)

diff --git a/yt_dlp/extractor/radiko.py b/yt_dlp/extractor/radiko.py
index 8c8fb1a8f..c363d9ba5 100644
--- a/yt_dlp/extractor/radiko.py
+++ b/yt_dlp/extractor/radiko.py
@@ -154,7 +154,7 @@ def _extract_formats(self, video_id, station, is_onair, ft, cursor, auth_token,
                     sf['preference'] = -100
                     sf['format_note'] = 'not preferred'
                 if not is_onair and timefree_int == 1 and time_to_skip:
-                    sf['downloader_options'] = {'ffmpeg_args': ['-ss', time_to_skip]}
+                    sf['downloader_options'] = {'ffmpeg_args': ['-ss', str(time_to_skip)]}
             formats.extend(subformats)

         return formats

CC: @garret1317

garret1317 commented 9 months ago

tested, can confirm the fix works but im curious why this behaviour is something you'd want surely you should download the whole programme then seek to the bit you want in your player? why start right in the middle of it?

garret1317 commented 9 months ago

the ffmpeg arg is needed for radiko.jp (not-live) format please disregard this message

either way it doesnt look like it's the ffmpeg arg that's doing the seeking forward, it's the seek query that gets added in RadikoIE._real_extract so an alternative fix is to just delete those lines (download still starts at the same time with the ffmpeg bit commented out,)

also, the seeking, with or without the ffmpeg arg, only works for certain formats: works on wowza, doesnt work on radiko.jp smartstream formats dont work with yt-dlp, but looking at the playlist with -g and curl, it works for them too