18 lines
544 B
Python
18 lines
544 B
Python
from typing import Any, AsyncIterable
|
|
|
|
from v6d2ctx.context import Explicit
|
|
from v6d3music.utils.aextract import aextract
|
|
|
|
__all__ = ("entries_for_url",)
|
|
|
|
|
|
async def entries_for_url(url: str) -> AsyncIterable[dict[str, Any]]:
|
|
info = await aextract({"logtostderr": True}, url, download=False, process=False)
|
|
if "__error__" in info:
|
|
raise Explicit("extraction error\n" + info.get("__error_str__"))
|
|
if "entries" in info:
|
|
for entry in info["entries"]:
|
|
yield entry
|
|
else:
|
|
yield info | {"url": url}
|