Scrape Untuk Channel youtube
Scrape Untuk Channel youtube
First code:
var scroll = setInterval(function(){ window.scrollBy(0, 1000)}, 1000);
Second code:
window.clearInterval(scroll); console.clear(); urls = $$('a'); urls.forEach(function(v,i,a){if (v.id=="video-title-link"){console.log('\t'+v.title+'\t'+v.href+'\t')}});
Scrape Untuk Playlist youtube
CODE 1:
let goToBottom = setInterval(() => window.scrollBy(0, 400), 1000);
CODE 2:
clearInterval(goToBottom);
let arrayVideos = [];
console.log('\n'.repeat(50));
const links = document.querySelectorAll('a');
for (const link of links) {
if (link.id === "video-title") {
link.href = link.href.split('&list=')[0];
arrayVideos.push(link.title + ';' + link.href);
console.log(link.title + '\t' + link.href);
}
}
Scrape untuk Shorts Youtube
First code:
var scroll = setInterval(function(){ window.scrollBy(0, 1000)}, 1000);
Second code:
window.clearInterval(scroll);
console.clear();
shorts = $$('ytd-rich-item-renderer');
shorts.forEach(function(short, i, shorts) {
const title = short.querySelector('#video-title').textContent;
const url = 'https://www.youtube.com' + short.querySelector('#thumbnail').href;
console.log('\t'+title+'\t'+url+'\t');
});