Traversing document only gathering 1 instance not all instances of target element

EDIT: AH…ID’s are unique. Yet each anchor tag has the same ID on the full page. YT is using a “formatted string” inside the anchor tag as well, any clue how to access that?

Hi, i’m trying to collate the video titles for a page of youtube videos.

here is the link I’m using

I started to copy & paste the titles, but realized javascript would be faster.

I used this which is straightforward, but it only grabs the first video title, 1 character at a time:

I don’t understand why it’s not grabbing all the videos on the page instead of just the first video?

titles = []
    titles = document.getElementById("video-title-link").title
console.log(titles)

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.