Open LukasThyWalls opened 9 years ago
The node.js module project ytdl-splitter-core/ytdl-splitter https://github.com/raltamirano/ytdl-splitter-core to do this behaviour.
Code lines are here https://github.com/raltamirano/ytdl-splitter-core/blob/master/index.js
I also have something like this: https://github.com/ajsnyde/YTDownloader
Nothing too special. I suggest checking out the regex. It is actually pretty accurate considering.
The data could be save to the subtitles. Alternatively the meta data fields comments
or lyrics
could be used.
Timestamp could also be parsed from comments: https://stackoverflow.com/questions/11067572/fetching-timestamps-hhmmss-from-youtube-comments-with-youtube-api-using-rege
edit:
I tested it with .srt
files, which work in vlc with audio or video. srt file has to have same name as audio file and a visualisation has to be enabled to make it work in vlc.
Documentation on srt: https://en.wikipedia.org/wiki/SubRip
Example video: Gorgon City - December Stream
Example comment from video:
0:00 Gorgon City - ID
2:28 Gorgon City - Sky High [DEFECTED]
5:18 Ed Butler - They Know [GOOD COMPANY]
8:27 Christian Nielsen - Nothing [REALM]
11:18 Gorgon City - Doubts [VIRGIN]
15:45 Apollo - Jump [NEWSTATE]
19:00 Hidden Empire - Palladion [STIL VOR TALENT]
22:39 Love Regenerator & Steve Lacy - Live Without Your Love (MK Remix) [DEFECTED]
25:00 Wett - All Night Long
28:05 Gorgon City & MK - There For You (Warehouse Mix) [VIRGIN EMI (UMG)]
32:10 Tom & Collins - Sombrerito [REALM]
36:00 Piem - Smooth [REALM]
40:33 Gorgon City ft. EVAN GIIA - Burning (Terrace Dub) [EMI]
44:25 Doorly & Mike Konstanty - Say Nay Say [REALM]
48:15 ID - ID
52:00 Frost - Overtones [ANJUNADEEP]
Example content of srt file (would be baked into audio file?):
1
00:00:00,000 --> 00:02:28,000
Gorgon City - ID
2
00:02:28,000 --> 00:05:18,000
Gorgon City - Sky High [DEFECTED]
3
00:05:18,000 --> 00:08:27,000
Ed Butler - They Know [GOOD COMPANY]
4
00:08:27,000 --> 00:11:18,000
Christian Nielsen - Nothing [REALM]
5
00:11:18,000 --> 00:15:45,000
Gorgon City - Doubts [VIRGIN]
...
Also works with mpv
In some large videos, the uploader usually marks in the description the parts of the video, putting the minutes and seconds of the beginning of a part. Something like this:
TITLE VIDEO
blablablablablabla... 00:00 Intro 05:00 First Part 10:00 Second Part etc. etc. etc.
It could be an option what read a description like that (if exists, if not exists it do nothing different) and divide the output file using every line with a time consecutively. In the example case: Making some output videos like "Title Video 1 Intro" (00:00-05:00), "Title Video 2 First Part" (05:00-10:00), "Title Video 3 Second Part" (10:00-End Video) of the whole video "Title Video". It could ignore the rest of the lines of the description without a time, use the rest of the line with the time as name of the file (normally it usually is in the beginning of the line, but it could be detected in any position with a proper RegExp, erasing the time and copying the rest of the line) and add a number of the consecutively files outputs order. Of course, need some postprocessing after download.
It was useful to have the parts of the video, like i was my case, i have to download the whole video and edit to cut the parts i need, and with this i can have the parts already prepared. It can be useful too for that EPs and LPs uploaded entire in one video, and it can be downloaded in separate tracks directly. And it can be useful not only in Youtube.