mirror of
https://github.com/kieraneglin/pinchflat.git
synced 2026-01-23 02:24:24 +00:00
[Bugfix] Respect cookies preference when performing download pre-check (#517)
* Updated get_downloadable_status to pass yt cookies * Updated tests
This commit is contained in:
parent
0be469dcb0
commit
a2a70fcce2
5 changed files with 222 additions and 156 deletions
|
|
@ -113,9 +113,10 @@ defmodule Pinchflat.Downloading.MediaDownloader do
|
|||
|
||||
defp download_with_options(url, item_with_preloads, output_filepath, override_opts) do
|
||||
{:ok, options} = DownloadOptionBuilder.build(item_with_preloads, override_opts)
|
||||
runner_opts = [output_filepath: output_filepath, use_cookies: item_with_preloads.source.use_cookies]
|
||||
use_cookies = item_with_preloads.source.use_cookies
|
||||
runner_opts = [output_filepath: output_filepath, use_cookies: use_cookies]
|
||||
|
||||
case YtDlpMedia.get_downloadable_status(url) do
|
||||
case YtDlpMedia.get_downloadable_status(url, use_cookies: use_cookies) do
|
||||
{:ok, :downloadable} -> YtDlpMedia.download(url, options, runner_opts)
|
||||
{:ok, :ignorable} -> {:error, :unsuitable_for_download}
|
||||
err -> err
|
||||
|
|
|
|||
|
|
@ -55,8 +55,11 @@ defmodule Pinchflat.YtDlp.Media do
|
|||
|
||||
Returns {:ok, :downloadable | :ignorable} | {:error, any}
|
||||
"""
|
||||
def get_downloadable_status(url) do
|
||||
case backend_runner().run(url, :get_downloadable_status, [:simulate, :skip_download], "%(.{live_status})j") do
|
||||
def get_downloadable_status(url, addl_opts \\ []) do
|
||||
action = :get_downloadable_status
|
||||
command_opts = [:simulate, :skip_download]
|
||||
|
||||
case backend_runner().run(url, action, command_opts, "%(.{live_status})j", addl_opts) do
|
||||
{:ok, output} ->
|
||||
output
|
||||
|> Phoenix.json_library().decode!()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue