Fixed old oversight re: original_url

This commit is contained in:
Kieran Eglin 2024-05-28 12:50:18 -07:00
parent 3fc83735c1
commit 54ad472044
No known key found for this signature in database
GPG key ID: 193984967FCF432D
3 changed files with 9 additions and 17 deletions

View file

@ -8,6 +8,8 @@ defmodule Pinchflat.Metadata.MetadataParser do
and not have it, ya know?
"""
alias Pinchflat.YtDlp.Media, as: YtDlpMedia
@doc """
Parses the given JSON response from yt-dlp and returns a map of
the needful media_item attributes, along with anything needed for
@ -24,15 +26,12 @@ defmodule Pinchflat.Metadata.MetadataParser do
end
defp parse_media_metadata(metadata) do
%{
media_id: metadata["id"],
title: metadata["title"],
original_url: metadata["original_url"],
description: metadata["description"],
media_filepath: metadata["filepath"],
livestream: !!metadata["was_live"],
duration_seconds: metadata["duration"] && round(metadata["duration"])
}
Map.merge(
Map.from_struct(YtDlpMedia.response_to_struct(metadata)),
%{
media_filepath: metadata["filepath"]
}
)
end
defp parse_subtitle_metadata(metadata) do

View file

@ -9637,7 +9637,7 @@
"uploader_url": "https://www.youtube.com/@PinchflatTestChannel",
"upload_date": "20210720",
"availability": "public",
"original_url": "ABC123",
"original_url": "https://www.youtube.com/watch?v=ABC123",
"webpage_url_basename": "watch",
"webpage_url_domain": "youtube.com",
"extractor": "youtube",

View file

@ -13,13 +13,6 @@ defmodule Pinchflat.MediaFixtures do
def media_item_fixture(attrs \\ %{}) do
media_id = Faker.String.base64(12)
# TODO: remove
attrs2 = Enum.into(attrs, %{})
if attrs2[:upload_date] || attrs2["upload_date"] do
raise "upload_date is not allowed in media_item_fixture. Use uploaded_at instead."
end
{:ok, media_item} =
attrs
|> Enum.into(%{