Create a video entity with chives
- ID
a222945- date
2026-02-28 01:27:59+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
97b4186- message
Create a video entity with chives- changed files
4 files, 22 additions
Changed files
dev_requirements.txt (2083) → dev_requirements.txt (2180)
diff --git a/dev_requirements.txt b/dev_requirements.txt
index 16f9907..8e0c5e5 100644
--- a/dev_requirements.txt
+++ b/dev_requirements.txt
@@ -1,5 +1,7 @@
# This file was autogenerated by uv via the following command:
# uv pip compile dev_requirements.in --output-file dev_requirements.txt
+alexwlchan-chives==23
+ # via -r requirements.txt
anyio==4.12.1
# via
# -r requirements.txt
@@ -60,6 +62,8 @@ packaging==26.0
# via pytest
pathspec==1.0.4
# via mypy
+pillow==12.1.1
+ # via -r requirements.txt
pluggy==1.6.0
# via pytest
pycparser==3.0
requirements.in (53) → requirements.in (78)
diff --git a/requirements.in b/requirements.in
index 43bf224..75070fa 100644
--- a/requirements.in
+++ b/requirements.in
@@ -1,3 +1,4 @@
+alexwlchan-chives[media]
gallery-dl
httpx
hyperlink
requirements.txt (1034) → requirements.txt (1128)
diff --git a/requirements.txt b/requirements.txt
index ec95bc2..e916f0a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,7 @@
# This file was autogenerated by uv via the following command:
# uv pip compile requirements.in --output-file requirements.txt
+alexwlchan-chives==23
+ # via -r requirements.in
anyio==4.12.1
# via httpx
brotli==1.2.0
@@ -35,6 +37,8 @@ idna==3.11
# requests
mutagen==1.47.0
# via yt-dlp
+pillow==12.1.1
+ # via alexwlchan-chives
pycparser==3.0
# via cffi
pycryptodomex==3.23.0
yt-dlp_alexwlchan.py (8195) → yt-dlp_alexwlchan.py (8610)
diff --git a/yt-dlp_alexwlchan.py b/yt-dlp_alexwlchan.py
index b0f35ed..9bf40a4 100755
--- a/yt-dlp_alexwlchan.py
+++ b/yt-dlp_alexwlchan.py
@@ -9,6 +9,7 @@ import sys
import tempfile
from typing import Any, TypedDict
+from chives.media import create_video_entity, VideoEntity
import httpx
import hyperlink
from yt_dlp import YoutubeDL
@@ -120,6 +121,8 @@ def get_instagram_avatar(tmp_dir: Path, uploader_name: str) -> Path:
"gallery-dl",
"--get-urls",
f"https://www.instagram.com/{uploader_name}/avatar",
+ "--cookies-from-browser",
+ "firefox",
]
)
avatar_url = output.strip().decode("utf8")
@@ -143,7 +146,9 @@ class VideoInfo(TypedDict):
video_path: Path
thumbnail_path: Path
subtitle_path: Path | None
+ folder_path: Path
uploader: UploaderInfo
+ entity: VideoEntity
site: str
@@ -254,6 +259,14 @@ def download_video(url: str) -> VideoInfo:
"thumbnail_path": thumbnail_path,
"subtitle_path": subtitle_path,
"uploader": uploader,
+ "entity": create_video_entity(
+ video_path,
+ poster_path=thumbnail_path,
+ subtitles_path=subtitle_path,
+ source_url=url,
+ background="#222222",
+ ),
+ "folder_path": tmp_dir,
"site": site,
}