diff options
author | metamuffin <metamuffin@disroot.org> | 2025-06-15 12:32:44 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-06-15 12:32:44 +0200 |
commit | f1d857b5ab44b35cf049981a2597b9a9610eae94 (patch) | |
tree | 20c9ea71158d4cf3d15c4a37f1a8d7e303f07492 | |
parent | 88a45d8003deb6804f90313e994fac1bf8eefce6 (diff) | |
download | isda-f1d857b5ab44b35cf049981a2597b9a9610eae94.tar isda-f1d857b5ab44b35cf049981a2597b9a9610eae94.tar.bz2 isda-f1d857b5ab44b35cf049981a2597b9a9610eae94.tar.zst |
add nicovideo support
-rw-r--r-- | scripts/ytdlp_download.md | 2 | ||||
-rw-r--r-- | scripts/ytdlp_download.ts | 2 | ||||
-rw-r--r-- | scripts/ytdlp_flatten.md | 11 | ||||
-rw-r--r-- | scripts/ytdlp_flatten.ts | 2 |
4 files changed, 11 insertions, 6 deletions
diff --git a/scripts/ytdlp_download.md b/scripts/ytdlp_download.md index c9f695a..26821e1 100644 --- a/scripts/ytdlp_download.md +++ b/scripts/ytdlp_download.md @@ -2,7 +2,7 @@ Downloads media with yt-dlp. -Currently supported task kinds are `youtube` and `bilibili`. +Currently supported task kinds are `youtube`, `niconico` and `bilibili`. The output directory is the tasks `output` data attribute which must be present. Additional yt-dlp arguments are added based on the task's `profile` attribute. diff --git a/scripts/ytdlp_download.ts b/scripts/ytdlp_download.ts index b6be66d..bd5e804 100644 --- a/scripts/ytdlp_download.ts +++ b/scripts/ytdlp_download.ts @@ -27,11 +27,13 @@ export class TextLineStream extends TransformStream<string, string> { const supported = [ "youtube", "bilibili", + "niconico", ] function key_to_url(key: string): string { const [kind, id] = key.split(":", 2) if (kind == "youtube") return `https://www.youtube.com/watch?v=${id}` if (kind == "bilibili") return `https://www.bilibili.com/video/${id}` + if (kind == "niconico") return `https://www.nicovideo.jp/watch/${id}` throw new Error("unknown kind"); } diff --git a/scripts/ytdlp_flatten.md b/scripts/ytdlp_flatten.md index dd7be2b..78e837a 100644 --- a/scripts/ytdlp_flatten.md +++ b/scripts/ytdlp_flatten.md @@ -2,8 +2,9 @@ Transforms a playlist-like object into the media items that make it up. -Currently supported task kinds are `youtube-channel` and `bilibili-channel`. -Where task ids are the ids assigned by the respective platform. +Currently supported task kinds are `youtube-channel`, `niconico-channel` and +`bilibili-channel`. Where task ids are the ids assigned by the respective +platform. ## Configuration @@ -17,7 +18,7 @@ Sample configuration: ```yaml ytdlp_flatten: - filters: - notlive: live_status=not_live - short: duration<300 + filters: + notlive: live_status=not_live + short: duration<300 ``` diff --git a/scripts/ytdlp_flatten.ts b/scripts/ytdlp_flatten.ts index 499233d..896e5a2 100644 --- a/scripts/ytdlp_flatten.ts +++ b/scripts/ytdlp_flatten.ts @@ -6,11 +6,13 @@ let config: Config = {} as unknown as Config const supported = [ "youtube-channel", "bilibili-channel", + "niconico-channel", ] function key_to_url(key: string): [string, string] { const [kind, id] = key.split(":", 2) if (kind == "youtube-channel") return ["youtube", `https://youtube.com/channel/${id}`] if (kind == "bilibili-channel") return ["bilibili", `https://space.bilibili.com/${id}/upload/video`] + if (kind == "niconico-channel") return ["niconico", `https://www.nicovideo.jp/user/${id}`] throw new Error("unknown kind"); } function key_to_infokey(key: string): string { |