EN
Youtube - print all video title and links in console using JavaScript
10 points
Solution (works on selectors as on 2021-10-03):
xxxxxxxxxx
1
console.log([document.querySelectorAll('#video-title')]
2
.map(entry => `${entry.text}\n${entry.href}`).join('\n\n'));
1. Open youtube channel (below link - Youtube Dirask channel):
2. Open dev tools (F12)
3. Enter above code
Output example:
xxxxxxxxxx
1
Inkscape how to add background to the SVG image
2
https://www.youtube.com/watch?v=lBPOEZLMdd4
3
4
Inkscape How to Draw Straight Line
5
https://www.youtube.com/watch?v=2OoQMLXGiyw
6
7
How to Download and Install Inkscape on Windows 10
8
https://www.youtube.com/watch?v=l4qB24OSjx8&t=7s
9
10
Inkscape how to scale svg image with keeping aspect ratio
11
https://www.youtube.com/watch?v=KiWdL16b-lw&t=11s
12
13
... other lines here
Other solutions:
xxxxxxxxxx
1
[document.querySelectorAll('#video-title')].map(entry => entry.text);
2
[document.querySelectorAll('#video-title')].map(entry => entry.href);
3
[document.querySelectorAll('#video-title')].map(entry => ({name: entry.text, link: entry.href}));
4
[document.querySelectorAll('#video-title')].map(entry => entry.href).join(' ');
5
[document.querySelectorAll('#video-title')].map(entry => `${entry.text} ${entry.href}`).join('\n');
6
console.log([document.querySelectorAll('#video-title')].map(entry => `${entry.text} ${entry.href}`).join('\n'));
xxxxxxxxxx
1
[document.querySelectorAll('#video-title')].map(entry => ({name: entry.text, link: entry.href}));
