The URL of the YouTube community post.
A promise that resolves to the scraped post data.
import { getYoutubePost } from 'nb-scraper';
async function fetchPost() {
const url = "http://youtube.com/post/UgkxChSWx6pfUUCxxHeR3LsodyV6Aqwf4GOS?si=tSbmlFuR2dYH_wtk";
const result = await getYoutubePost(url);
if (result.status) {
console.log(`Post by ${result.data.author}`);
console.log(`Content: ${result.data.text}`);
console.log(`Post Type: ${result.data.postType}`);
} else {
console.error(result.error);
}
}
fetchPost();
Scrapes a YouTube community post to extract its content. Supports text, single/multiple images, polls, and video shares.