• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript I need a help to get a list of videos url, title, views & upload date in youtube channel


New Coder
I need a help to get a list of videos url, title, views & upload date in youtube channel

Already I have few codes to get a list videos url & title. But I also need views & upload date. Can anyone please help me in this.

1. Open YouTube channel
2. Click of Video Tab
3. Right-click on the page
4. Click on Inspect
5. Click on Console
6. Copy and Paste this Code and Press Enter
var scroll = setInterval(function(){ window.scrollBy(0, 1000)}, 1000);

7. Wait till loading all videos
8. Copy and Paste this Code and Press Enter
window.clearInterval(scroll); console.clear(); urls = $$('a'); urls.forEach(function(v,i,a){if (v.id=="video-title"){console.log('\t'+v.title+'\t'+v.href+'\t')}});

9. Click any URL and Press Ctrl+A
10. Open Microsoft Excel or Word and Press Ctrl+v

Can anyone help me to get views + Upload date too in this format. Thanks in Advance


King Coder
You don't give any clue into how you're doing things. I would make the site a string and then search for keywords and then extract the info I needed. First word to search for is ytd-video-view-count-renderer and the second is ytd-video-primary-info-renderer. See the code below:
<ytd-badge-supported-renderer class="style-scope ytd-video-primary-info-renderer" disable-upgrade="" hidden ytd-badge-supported-renderer>
    <div id="info" class="style-scope ytd-video-primary-info-renderer">
      <div id="info-text" class="style-scope ytd-video-primary-info-renderer">
        <div id="count" class="style-scope ytd-video-primary-info-renderer">
          <ytd-video-view-count-renderer class="style-scope ytd-video-primary-info-renderer" small="">
            <span class="view-count style-scope ytd-video-view-count-renderer">39,214 views</span>
            <span class="short-view-count style-scope ytd-video-view-count-renderer">39K views</span>

        <div id="info-strings" class="style-scope ytd-video-primary-info-renderer">

          <span id="dot" class="style-scope ytd-video-primary-info-renderer"></span>

        <yt-formatted-string class="style-scope ytd-video-primary-info-renderer">Nov 20, 2021</yt-formatted-string>