@@ -17,25 +17,60 @@ async function main() {
1717 } ) ;
1818 console . log ( 'ℹ️ Transcript:' , transcript ) ;
1919
20- // Example 2: Scrape web content
20+ // Example 2: Get YouTube video info
21+ console . log ( '\nℹ️ Getting YouTube video info...' ) ;
22+ const videoInfo = await supadata . youtube . video ( {
23+ id : 'dQw4w9WgXcQ' , // Famous Rick Astley video as an example
24+ } ) ;
25+ console . log ( 'ℹ️ Video info:' , videoInfo ) ;
26+
27+ // Example 3: Get YouTube channel info
28+ console . log ( '\nℹ️ Getting YouTube channel info...' ) ;
29+ const channelInfo = await supadata . youtube . channel ( {
30+ id : 'https://www.youtube.com/@Fireship' , // Fireship channel as an example
31+ } ) ;
32+ console . log ( 'ℹ️ Channel info:' , channelInfo ) ;
33+
34+ // Example 4: Get YouTube channel videos
35+ console . log ( '\nℹ️ Getting YouTube channel videos...' ) ;
36+ const channelVideos = await supadata . youtube . channel . videos ( {
37+ id : 'https://www.youtube.com/@Fireship' , // Fireship channel as an example
38+ } ) ;
39+ console . log ( 'ℹ️ Channel videos:' , channelVideos ) ;
40+
41+ // Example 5: Get YouTube playlist info
42+ console . log ( '\nℹ️ Getting YouTube playlist info...' ) ;
43+ const playlistInfo = await supadata . youtube . playlist ( {
44+ id : 'PL0vfts4VzfNjnYhJMfTulea5McZbQLM7G' , // Fireship playlist as an example
45+ } ) ;
46+ console . log ( 'ℹ️ Playlist info:' , playlistInfo ) ;
47+
48+ // Example 6: Get YouTube playlist videos
49+ console . log ( '\nℹ️ Getting YouTube playlist videos...' ) ;
50+ const playlistVideos = await supadata . youtube . playlist . videos ( {
51+ id : 'PL0vfts4VzfNjnYhJMfTulea5McZbQLM7G' , // Fireship playlist as an example
52+ } ) ;
53+ console . log ( 'ℹ️ Playlist videos:' , playlistVideos ) ;
54+
55+ // Example 7: Scrape web content
2156 console . log ( '\nℹ️ Scraping web content...' ) ;
2257 const webContent = await supadata . web . scrape ( 'https://supadata.ai' ) ;
2358 console . log ( 'ℹ️ Web content:' , webContent ) ;
2459
25- // Example 3 : Map website URLs
60+ // Example 8 : Map website URLs
2661 console . log ( '\nℹ️ Mapping website URLs...' ) ;
2762 const siteMap = await supadata . web . map ( 'https://supadata.ai' ) ;
2863 console . log ( 'ℹ️ Site map:' , siteMap ) ;
2964
30- // Example 4 : Crawl website with limit
65+ // Example 9 : Crawl website with limit
3166 console . log ( '\nℹ️ Crawling website...' ) ;
3267 const crawl = await supadata . web . crawl ( {
3368 url : 'https://supadata.ai' ,
3469 limit : 3 , // Limiting to 3 pages for the example
3570 } ) ;
3671 console . log ( 'ℹ️ Crawl job started:' , crawl ) ;
3772
38- // Example 5 : Get crawl results
73+ // Example 10 : Get crawl results
3974 console . log ( '\nℹ️ Getting crawl results...' ) ;
4075 const crawlResults = await supadata . web . getCrawlResults ( crawl . jobId ) ;
4176 console . log ( 'ℹ️ Crawl results:' , crawlResults ) ;
0 commit comments