You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using extra_arg("--download-archive") (and next as path to the archive file), the downloader will fail with error if the file already exists in the archive. This is caused by yt-dlp returning null in stdout when -J is specified and the video is already in the download archive.
Hey, @whargrove! I'm not the maintainer, but out of frustration with these errors, I ended up trying to write my own yt-dlp library. However, yt-dlp emits output as JSON. You can check it with yt-dlp --dump-json! Working with it can be a massive pain - mostly because of the JSON parsing you can see above. In writing my own version of the lib, I inevitably found json_typegen, a tool which automatically creates Rust structs from JSON input.
That sounds annoying to me, but I figured out that you either have to choose between:
Writing ALL OF THE STRUCTS YOURSELF (!!!) or
Generating them :)
Anyone with the knowledge would want to generate them. You can do so with the json_typegen tool I mentioned earlier. I think, though, that in making the library, the maintainer removed the generated serde_json::Value typed fields to allow easier use for... users! However, this change seems to result in weird JSON errors when values don't fit their expected type. It certainly makes sense that the errors bubble up from serde_json, then! In fact, I found your error here!
Since no one could ever possibly have enough time to maintain each type of value and check every website type, it's probably a good idea to utilize the Value type and just provide some tools to help users work around it. In particular, documenting the usage of TryFrom on the Value type would probably help to make the library keep its correctness without eluding utility to its users.
@GyrosOfWar, would you be interested in taking another look at this? I think it would make your great library much more useful! :)
When using
extra_arg("--download-archive")
(and next as path to the archive file), the downloader will fail with error if the file already exists in the archive. This is caused by yt-dlp returningnull
in stdout when-J
is specified and the video is already in the download archive.For example:
When using the library it fails with a json error: "json error: invalid type: null, expected struct SingleVideo"
Recommend that YoutubeDlOutput be extended with new symbol:
ArchivedSingleVideo
if stdout contains "null" and--download-archive
arg is used.The text was updated successfully, but these errors were encountered: