Fixed old oversight re: original_url
This commit is contained in:
parent
3fc83735c1
commit
54ad472044
3 changed files with 9 additions and 17 deletions
|
|
@ -8,6 +8,8 @@ defmodule Pinchflat.Metadata.MetadataParser do
|
||||||
and not have it, ya know?
|
and not have it, ya know?
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
alias Pinchflat.YtDlp.Media, as: YtDlpMedia
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Parses the given JSON response from yt-dlp and returns a map of
|
Parses the given JSON response from yt-dlp and returns a map of
|
||||||
the needful media_item attributes, along with anything needed for
|
the needful media_item attributes, along with anything needed for
|
||||||
|
|
@ -24,15 +26,12 @@ defmodule Pinchflat.Metadata.MetadataParser do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp parse_media_metadata(metadata) do
|
defp parse_media_metadata(metadata) do
|
||||||
%{
|
Map.merge(
|
||||||
media_id: metadata["id"],
|
Map.from_struct(YtDlpMedia.response_to_struct(metadata)),
|
||||||
title: metadata["title"],
|
%{
|
||||||
original_url: metadata["original_url"],
|
media_filepath: metadata["filepath"]
|
||||||
description: metadata["description"],
|
}
|
||||||
media_filepath: metadata["filepath"],
|
)
|
||||||
livestream: !!metadata["was_live"],
|
|
||||||
duration_seconds: metadata["duration"] && round(metadata["duration"])
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
defp parse_subtitle_metadata(metadata) do
|
defp parse_subtitle_metadata(metadata) do
|
||||||
|
|
|
||||||
|
|
@ -9637,7 +9637,7 @@
|
||||||
"uploader_url": "https://www.youtube.com/@PinchflatTestChannel",
|
"uploader_url": "https://www.youtube.com/@PinchflatTestChannel",
|
||||||
"upload_date": "20210720",
|
"upload_date": "20210720",
|
||||||
"availability": "public",
|
"availability": "public",
|
||||||
"original_url": "ABC123",
|
"original_url": "https://www.youtube.com/watch?v=ABC123",
|
||||||
"webpage_url_basename": "watch",
|
"webpage_url_basename": "watch",
|
||||||
"webpage_url_domain": "youtube.com",
|
"webpage_url_domain": "youtube.com",
|
||||||
"extractor": "youtube",
|
"extractor": "youtube",
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,6 @@ defmodule Pinchflat.MediaFixtures do
|
||||||
def media_item_fixture(attrs \\ %{}) do
|
def media_item_fixture(attrs \\ %{}) do
|
||||||
media_id = Faker.String.base64(12)
|
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} =
|
{:ok, media_item} =
|
||||||
attrs
|
attrs
|
||||||
|> Enum.into(%{
|
|> Enum.into(%{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue