Skip to content

Commit

Permalink
fix youtube links in doc extract
Browse files Browse the repository at this point in the history
  • Loading branch information
devxpy committed Feb 13, 2024
1 parent eee1578 commit 709331d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion daras_ai/image_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ def safe_filename(filename: str) -> str:
return out


def truncate_filename(text: str, maxlen: int = 100, sep: str = "...") -> str:
def truncate_filename(
text: str | bytes, maxlen: int = 100, sep: str | bytes = "..."
) -> str | bytes:
if len(text) <= maxlen:
return text
assert len(sep) <= maxlen
Expand Down
6 changes: 4 additions & 2 deletions recipes/DocExtract.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,11 @@ def process_source(
)

content_url = existing_values[Columns.content_url.value]
is_pdf = "application/pdf" in doc_meta.mime_type
is_yt = is_yt_url(webpage_url)
is_video = "video/" in doc_meta.mime_type or "audio/" in doc_meta.mime_type
is_pdf = doc_meta and "application/pdf" in doc_meta.mime_type
is_video = doc_meta and (
"video/" in doc_meta.mime_type or "audio/" in doc_meta.mime_type
)
if not content_url:
yield "Downloading"
if is_yt:
Expand Down

0 comments on commit 709331d

Please sign in to comment.