Fixed issue with source details when first video is a premier

This commit is contained in:
Kieran Eglin 2024-03-12 12:07:48 -07:00
parent 3c897e96e6
commit 5bc3a0e09d
No known key found for this signature in database
GPG key ID: 193984967FCF432D
2 changed files with 5 additions and 2 deletions

View file

@ -54,7 +54,10 @@ defmodule Pinchflat.YtDlp.MediaCollection do
Returns {:ok, map()} | {:error, any, ...}. Returns {:ok, map()} | {:error, any, ...}.
""" """
def get_source_details(source_url) do def get_source_details(source_url) do
opts = [:simulate, :skip_download, playlist_end: 1] # `ignore_no_formats_error` is necessary because yt-dlp will error out if
# the first video has not released yet (ie: is a premier). We don't care about
# available formats since we're just getting the source details
opts = [:simulate, :skip_download, :ignore_no_formats_error, playlist_end: 1]
output_template = "%(.{channel,channel_id,playlist_id,playlist_title})j" output_template = "%(.{channel,channel_id,playlist_id,playlist_title})j"
with {:ok, output} <- backend_runner().run(source_url, opts, output_template), with {:ok, output} <- backend_runner().run(source_url, opts, output_template),

View file

@ -87,7 +87,7 @@ defmodule Pinchflat.YtDlp.MediaCollectionTest do
test "it passes the expected args to the backend runner" do test "it passes the expected args to the backend runner" do
expect(YtDlpRunnerMock, :run, fn @channel_url, opts, ot -> expect(YtDlpRunnerMock, :run, fn @channel_url, opts, ot ->
assert opts == [:simulate, :skip_download, playlist_end: 1] assert opts == [:simulate, :skip_download, :ignore_no_formats_error, playlist_end: 1]
assert ot == "%(.{channel,channel_id,playlist_id,playlist_title})j" assert ot == "%(.{channel,channel_id,playlist_id,playlist_title})j"
{:ok, "{}"} {:ok, "{}"}