A commandline tool for youtube.

Did you ever want to conveniently search a youtube video’s comments in a textfile? or find that specific comment in a long speech. Maybe you are interested when exactly one subject was talked about in a live chat.

I wrote a python commandline tool for that: yttool.

Note that youtube also auto generates subtitles, so you can use the –subtitles feature on almost any video.

Example usage:

Show the description and some general info for this Numberphile video:

+ yttool --info 'https://www.youtube.com/watch?v=bJOuzqu3MUQ'

bJOuzqu3MUQ - A Miraculous Proof (Ptolemy's Theorem) - Numberphile
By: Numberphile

viewcount: 386748, length: 0:38:28, sentiment: 13.783 / 212, published: 2020-02-09

Featuring Zvezdelina Stankova... Want more? 
Part 2 (bringing in Pentagons and the Golden Ratio) is at: https://youtu.be/o3QBgkQi_HA
More links & stuff in full description below โ†“โ†“โ†“ 
...

Or view the subtitles:

+ yttool --subtitles 'https://www.youtube.com/watch?v=bJOuzqu3MUQ'

we'll talk about one theorem that I
learned when I was in high school and
the seemingly miraculous methods to
solve it which is my favorite thing from
the training for the International math
Olympia back in Bulgaria the theorem is
called ptolemies theorem and the method
will wait a few minutes before we get
there well let's start with something
that everyone knows what is the theorem
Brady that you think everyone knows no
geometry Pythagoras absolutely well what
do you know about it even I know this
one a squared plus B squared is equal to
...

Or view the subtitles with timestamps:

+ yttool -v --subtitles 'https://www.youtube.com/watch?v=bJOuzqu3MUQ'
0:00:00.030  we'll talk about one theorem that I
0:00:01.860  learned when I was in high school and
0:00:04.140  the seemingly miraculous methods to
0:00:07.830  solve it which is my favorite thing from
0:00:11.070  the training for the International math
0:00:13.170  Olympia back in Bulgaria the theorem is
0:00:16.080  called ptolemies theorem and the method
0:00:19.080  will wait a few minutes before we get
0:00:21.720  there well let's start with something
0:00:23.609  that everyone knows what is the theorem
0:00:26.250  Brady that you think everyone knows no
0:00:29.699  geometry Pythagoras absolutely well what
0:00:33.450  do you know about it even I know this
0:00:35.399  one a squared plus B squared is equal to
...

Or maybe we want the subtitles in .srt format:

+ yttool --srt --subtitles 'https://www.youtube.com/watch?v=bJOuzqu3MUQ'
1
0:00:00,030 --> 0:00:04,140
we'll talk about one theorem that I

1
0:00:01,860 --> 0:00:07,830
learned when I was in high school and

1
0:00:04,140 --> 0:00:11,070
the seemingly miraculous methods to
...

Get the english subtitles for this ElectroBoom video:

+ yttool --language en --subtitles 'https://www.youtube.com/watch?v=0xY06PT5JDE'
Hi, I got my hands on a bunch of these Thermoelectric Peltier devices ,thanks to Circuit Specialists.
I've never used them before but, from what I know when you apply electricity to them they pump heat.
Well, let's power it with 12 volt DC. I know the theory -(gets shocked)
Sh** ow(gets shocked again)
I know the theory behind it, but I haven't really experienced one
What? This - OWW(gets burned)
...

Or view the automatic translation:

+ yttool --language asr --subtitles 'https://www.youtube.com/watch?v=0xY06PT5JDE'
hi I got my hands on a bunch of these
thermoelectric Peltier devices thanks to
secular specialists I've never used them
before but from what I know when you
apply electricity to them they pump Heat
well let's power it with 12 volt DC I
know that theory but I know the theory
...

Now what are the comments for the numberphile video saying:

+ yttool --comments 'https://www.youtube.com/watch?v=bJOuzqu3MUQ'
---> Numberphile
Part 2 - using the theorem to show some cool stuff: https://youtu.be/o3QBgkQi_HA
And a bit extra on inversion: https://youtu.be/qmfFH1SyXP0
------> Phil Boswell
I like the extra length, gives us more to chew on!
------> HighMans
Name typo! It's Zvezdelina Stankova, missing the 'Z'.
------> Kasa Jizo
Yo Numberphile we need some more Simon Pampena
------> Linda Ristevski
You made my day, Numberphile! Quality!
------> Qwertyuoip 123
Man, long shoot!
...

Or lets view the livechat for the Scott Manley Live broadcast of the Crew Dragon Spacecraft:

+ yttool --livechat 'https://www.youtube.com/watch?v=lE0u_jIDh0E'
---> -0:58 M K
k
---> -0:58 Sam Bowen
I bet reds is....red right now ๐Ÿ˜ž
---> -0:58 James Adams
Reds your doing that thing that you don't like, that thing that reminds you of your youth. don't do it to us Reds. please!
---> -0:57 Midgard Eagle
Scott Manley stream is not go go go ๐Ÿ˜•
---> -0:57 Cheshire Viq
no way
---> -0:54 Muhammad
Going back to Everyday stronauty
...

Or maybe we want to see what video’s are in this System of a Down playlist:

+ yttool --playlist 'https://www.youtube.com/playlist?list=PLSKnqXUHTaSdXuK8Z2d-hXLFtJbRZwPtJ'
CSvFpBOe8eY - System Of A Down - Chop Suey! (Official Video)
zUzd9KyIDrM - System Of A Down - B.Y.O.B. (Official Video)
L-iepu3EtyE - System Of A Down - Aerials (Official Video)
iywaBOMvYLI - System Of A Down - Toxicity (Official Video)
DnGdoEa1tPg - System Of A Down - Lonely Day (Official Video)
LoheCz4t2xc - System Of A Down - Hypnotize (Official Video)
5vBGOrI6yBk - System Of A Down - Sugar (Official Video)
SqZNMvIEHhs - System Of A Down - Spiders (Official Video)
ENBv2i88g6Y - System Of A Down - Question! (Official Video)
bE2r7r7VVic - System Of A Down - Boom! (Official Video)
F46r-_jPPHY - System Of A Down - War? (Official Video)

Or do you want a list of all Numberphile video’s?

+ yttool -l https://www.youtube.com/channel/UCoxcjq-8xIDTYp3uz647V5A
IMY2_yzDm9I - A Surprising Pi and 5 - Numberphile
wTUSz-HSaBg - Matrix Factorization - Numberphile
qu04xLNrk94 - Euler Squares - Numberphile
n2Kp3toDJ9c - Lewis Carroll's Pillow Problem - Numberphile
YI1WqYKHi78 - Why is this Puzzle Impossible? - Numberphile
X3l0fPHZja8 - The Daddy of Big Numbers (Rayo's Number) - Numberphile
xyVl-tcB8pI - Impossible Squares - Numberphile
mTvKQYTV0Yw - Mathematics and Coronavirus - Numberphile
k6nLfCbAzgo - The Coronavirus Curve - Numberphile
...

You can get the same from the /user/ link:

+ yttool -l https://www.youtube.com/user/numberphile
==> https://www.youtube.com/channel/UCoxcjq-8xIDTYp3uz647V5A <==
IMY2_yzDm9I - A Surprising Pi and 5 - Numberphile
wTUSz-HSaBg - Matrix Factorization - Numberphile
qu04xLNrk94 - Euler Squares - Numberphile
n2Kp3toDJ9c - Lewis Carroll's Pillow Problem - Numberphile
YI1WqYKHi78 - Why is this Puzzle Impossible? - Numberphile
X3l0fPHZja8 - The Daddy of Big Numbers (Rayo's Number) - Numberphile
xyVl-tcB8pI - Impossible Squares - Numberphile
mTvKQYTV0Yw - Mathematics and Coronavirus - Numberphile
...

Maybe i want a large list of mathematics related video’s:

+ yttool -q mathematics
m5vw4ajnWGA - Mos Def - Mathematics
OmJ-4B-mS-Y - The Map of Mathematics
8mve0UoSxTo - Mathematics is the queen of Sciences
bqGXdh6zb2k - Intro to the Philosophy of Mathematics (Ray Monk)
KTUVdXI2vng - Crisis in the Foundation of Mathematics | Infinite Series
I86TArVgnNs - 2 + 2 = 5 How | Breaking the rules of mathematics | Fun of Mathematics: Ep 1
fbrQ8F-LQNs - Why most people are bad at mathematics - Neil deGrasse Tyson asks Richard Dawkins
SEiSloE1r-A - The surprising beauty of mathematics | Jonathan Matte | TEDxGreensFarmsAcademy
z5lo0uNQL7I - This is what a pure mathematics exam looks like at university
dAgfnK528RA - Math Antics - Order Of Operations
...