youtube-dl を使用して YouTube チャンネルのすべての動画リストをダウンロードして並べ替えます。

youtube-dl を使用して YouTube チャンネルのすべての動画リストをダウンロードして並べ替えます。

YouTube チャンネルのすべての動画のリストをダウンロードして、期間ごとに並べ替えたいと思います。私が試したことは次のとおりです。YouTube-DLそれぞれ。yt-dlp:

yt-dlp --skip-download "url_to_channel" --get-duration --get-title > list

そしてそのようなものcat list | sed '$!N;s/\n/ /g' | sort。ただし、期間が2番目に印刷されるため機能しません(タイトルsort -k2にスペースが含まれているため役に立ちません)。

一日の終わりに、URLとタイトルをインポートしてからhtmlファイル(またはLatex - > pdf)にパイプして、クリック可能なURLとサムネイルを含むリストを取得したいと思います。 (この質問の内容はそれではありません。、しかし、あなたは答えを書くときにこれを考えました。私は最初に上記の簡単なケースを扱いたいと思います。

編集する

たとえば、

yt-dlp --skip-download "https://www.youtube.com/user/emacsrocks/videos" --get-duration --get-title > list_test

明らかにする

cat list_test

Parens of the Dead Live - Preparing for a new game, bonus stream, live on Twitch
1:06:45
Parens of the Dead Live - Improving the code 3 years later, live on Twitch
1:55:55
Emacs Rocks! Episode 17: Magit
2:39
Emacs Rocks! Episode 16: Dired
1:35
Parens of the Dead - Episode 8: The Hour of Reckoning
9:52
Parens of the Dead - Episode 7: Eaten by Zombies
3:50
Parens of the Dead - Episode 6: Quickly, hide!
9:44
Parens of the Dead - Episode 5: Re-animated
9:09
Parens of the Dead - Episode 4: Waking the Dead
4:59
Parens of the Dead - Episode 3: What Lies Beneath
9:27
Parens of the Dead - Episode 2: Frontal Assault
8:02
Parens of the Dead - Episode 1: Lying in the Ground
11:33
Emacs Rocks! Episode 15: restclient-mode
2:24
Emacs Rocks at WebRebels! Part 05: more js2-refactor
55
Emacs Rocks at WebRebels! Part 04: more js2-refactor
1:58
Emacs Rocks at WebRebels! Part 03: js2-refactor
59
Emacs Rocks at WebRebels! Part 02: multiple-cursors
41
Emacs Rocks at WebRebels! Part 01: Jumping to the next slide
2:19
Emacs Rocks! Episode 14: Paredit
3:25
Extending Emacs Rocks! Episode 08
8:10
Extending Emacs Rocks! Episode 07
11:06
Emacs Rocks! Episode 13: multiple-cursors
3:56
Emacs Rocks! Episode 12: Working with HTML
1:54
Extending Emacs Rocks! Episode 06
9:26
Emacs Rocks! Episode 11: swank-js
4:35
Extending Emacs Rocks! Episode 05
9:18
Extending Emacs Rocks! Episode 04
10:44
Extending Emacs Rocks! Episode 03
10:32
Extending Emacs Rocks! Episode 01
11:15
Extending Emacs Rocks! Episode 02
8:00
Emacs Rocks! Live at WebRebels
18:18
Emacs Rocks! Episode 10: Jumping around
2:07
Emacs Rocks! Episode 09: expand-region
2:39
Emacs Rocks! Episode 08: mark-multiple
1:30
Emacs Rocks! Episode 07: Mind. Exploded.
1:30
Emacs Rocks! Episode 06: Yeah! Snippets!
1:41
Emacs Rocks! Episode 05: Macros in style
1:31
Emacs Rocks! Episode 04: A rebind controversy
2:32
Emacs Rocks! Episode 03: A vimgolf albatross
2:15
Emacs Rocks! Episode 02: A vimgolf eagle
3:15
Emacs Rocks! Episode 01: From var to this
2:47

ベストアンサー1

youtube-dlデータ出力を要求したjson後に処理できます(フラグ付きのフィールドjqだけでなく、すべてのフィールドにアクセスできます)。get-...

このコマンドは次のとおりです。

youtube-dl --dump-json "https://www.youtube.com/user/emacsrocks/videos" | jq -r '[.duration,.title]|@csv'

以下を出力します。

4005,"Parens of the Dead Live - Preparing for a new game, bonus stream, live on Twitch"
6955,"Parens of the Dead Live - Improving the code 3 years later, live on Twitch"
159,"Emacs Rocks! Episode 17: Magit"
95,"Emacs Rocks! Episode 16: Dired"
592,"Parens of the Dead - Episode 8: The Hour of Reckoning"
230,"Parens of the Dead - Episode 7: Eaten by Zombies"
...
91,"Emacs Rocks! Episode 05: Macros in style"
152,"Emacs Rocks! Episode 04: A rebind controversy"
135,"Emacs Rocks! Episode 03: A vimgolf albatross"
195,"Emacs Rocks! Episode 02: A vimgolf eagle"
167,"Emacs Rocks! Episode 01: From var to this"

その後、たとえばを使用できますsort

おすすめ記事