filters
This commit is contained in:
parent
1c44e0cc7f
commit
3f41a52e56
1 changed files with 22 additions and 3 deletions
|
@ -202,14 +202,14 @@ def extract_channel(channel_id: str) -> dict:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def extract_channel_videos(channel_id: str) -> list[str]:
|
def extract_videos(channel_id: str) -> list[str]:
|
||||||
"""Return extracted channel videos dict.
|
"""Return extracted channel videos dict.
|
||||||
|
|
||||||
:rtype: dict
|
:rtype: dict
|
||||||
"""
|
"""
|
||||||
d = extract({
|
d = extract({
|
||||||
}, f"{URL}/channel/{channel_id}/videos")
|
}, f"{URL}/channel/{channel_id}/videos")
|
||||||
log.info(d)
|
return d
|
||||||
return [entry["id"] for entry in reversed(d["entries"])]
|
return [entry["id"] for entry in reversed(d["entries"])]
|
||||||
|
|
||||||
|
|
||||||
|
@ -220,12 +220,31 @@ def extract_video(video_id: str) -> dict:
|
||||||
"""
|
"""
|
||||||
d = extract({
|
d = extract({
|
||||||
}, f"{URL}/watch?v={video_id}")
|
}, f"{URL}/watch?v={video_id}")
|
||||||
log.info(d)
|
return d
|
||||||
|
|
||||||
|
|
||||||
|
def filter_video(d: dict) -> dict:
|
||||||
|
"""Return filtered video dict.
|
||||||
|
|
||||||
|
:param d: video info dict
|
||||||
|
:type d: dict
|
||||||
|
:rtype: dict
|
||||||
|
"""
|
||||||
return {
|
return {
|
||||||
"title": d["title"],
|
"title": d["title"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def filter_videos(d: dict) -> list[str]:
|
||||||
|
"""Return filtered videos dict.
|
||||||
|
|
||||||
|
:param d: videos dict
|
||||||
|
:type d: dict
|
||||||
|
:rtype: dict
|
||||||
|
"""
|
||||||
|
return [entry["id"] for entry in reversed(d["entries"])]
|
||||||
|
|
||||||
|
|
||||||
def next_download(videos: list[str]) -> str | None:
|
def next_download(videos: list[str]) -> str | None:
|
||||||
index = 0
|
index = 0
|
||||||
for video_id in videos:
|
for video_id in videos:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue