about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-24 11:42:13 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-24 11:45:35 +0200
commitdde1e0b672dc9829de4120f87464d00a79535e15 (patch)
tree997a916a055e3ad721b8f2964f0c2d61f32f532c
parentfix(storage/database): Already borrow the `VideoStatus::ALL` constant (diff)
downloadyt-dde1e0b672dc9829de4120f87464d00a79535e15.tar.gz
yt-dde1e0b672dc9829de4120f87464d00a79535e15.zip
fix(update_raw.py): Only return the needed fields to rust
This avoids a spurious failure, when the processed dict contains values,
that can't be serialized as JSON (e.g. a LazyList).
-rwxr-xr-xpython_update/raw_update.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/python_update/raw_update.py b/python_update/raw_update.py
index c443960..21569d2 100755
--- a/python_update/raw_update.py
+++ b/python_update/raw_update.py
@@ -118,10 +118,16 @@ class Fetcher:
         with yt_dlp.YoutubeDL(self.ydl_opts) as ydl:
             processed = ydl.process_ie_result(entry, False)
 
-            # walk through the ie_result dictionary to force evaluation of lazily loaded resources
-            repr(processed)
-
-            return processed
+            return {
+                "description": processed.get("description"),
+                "duration": processed.get("duration"),
+                "upload_date": processed.get("upload_date"),
+                "thumbnails": processed.get("thumbnails"),
+                "thumbnail": processed.get("thumbnail"),
+                "title": processed.get("title"),
+                "webpage_url": processed.get("webpage_url"),
+                "id": processed.get("id")
+            }
 
     async def process_entry(self, url: str, entry: Any) -> Optional[Any]:
         try: