Languages
[Edit]
EN

Youtube - print all video title and links in console using JavaScript

10 points
Created by:
Elias999
759

Solution (works on selectors as on 2021-10-03):

console.log([...document.querySelectorAll('#video-title')]
    .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:

Inkscape how to add background to the SVG image
https://www.youtube.com/watch?v=lBPOEZLMdd4

Inkscape How to Draw Straight Line
https://www.youtube.com/watch?v=2OoQMLXGiyw

How to Download and Install Inkscape on Windows 10
https://www.youtube.com/watch?v=l4qB24OSjx8&t=7s

Inkscape how to scale svg image with keeping aspect ratio
https://www.youtube.com/watch?v=KiWdL16b-lw&t=11s

... other lines here

 

Other solutions: 

[...document.querySelectorAll('#video-title')].map(entry => entry.text);
[...document.querySelectorAll('#video-title')].map(entry => entry.href);
[...document.querySelectorAll('#video-title')].map(entry => ({name: entry.text, link: entry.href}));
[...document.querySelectorAll('#video-title')].map(entry => entry.href).join(' ');
[...document.querySelectorAll('#video-title')].map(entry => `${entry.text} ${entry.href}`).join('\n');
console.log([...document.querySelectorAll('#video-title')].map(entry => `${entry.text} ${entry.href}`).join('\n'));

 

Create json

[...document.querySelectorAll('#video-title')].map(entry => ({name: entry.text, link: entry.href}));
Youtube - print all video title and links in console as json
Youtube - print all video title and links in console as json

See also

Alternative titles

  1. Youtube print all video links in browser console using javascript
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join