SuspiciousLookingOwl / scrape-yt

Simple lib to scrape information from youtube such as search results, video information, related videos, playlist information and up next video
https://www.npmjs.com/package/scrape-yt
MIT License
9 stars 3 forks source link

Enhancement : Thumbnail Url on getVideo() #10

Closed SteeledSlagle13 closed 4 years ago

SteeledSlagle13 commented 4 years ago

hey would it be possible to get the url of the video thumbnail on the getVideo() like the search()

scrapeYt.getVideo('u1P1nkbuz6k').then((videoInfo: Video) => {
    console.log(videoInfo);
});
{
  id: 'u1P1nkbuz6k',
  title: 'SICKEST Mario Party RAP!! - ANIMATED MUSIC VIDEO (animated by Gregzilla)',
  duration: 215,
  description: 'Get the album NOW ► http://starbomb.com\n' +
    'MERCH!! ► http://www.starbomb.com/merch\n' +
    'Click for MORE VIDS! ► http://www.youtube.com/subscription_c...\n' +
    '\n' +
    'Animated by ► https://www.youtube.com/channel/UC5X_...\n' +
    '\n' +
    '\n' +
    '-----------------------------------------------------------------------------\n' +
    '\n' +
    'Starbomb Facebook: https://www.facebook.com/starbombband\n' +
    '\n' +
    'Starbomb Twitter: https://twitter.com/starbomb\n' +
    '\n' +
    'http://www.starbomb.com',
  channel: {
    id: 'UC0gEw6pgNkLkkzMwzX4UtHA',
    name: 'Egoraptor',
    thumbnail: 'https:https://yt3.ggpht.com/a/AATXAJw3OtXq_3S0KSyS3kJ7o1ZXzzKWGxSJf-aQXg=s176-c-k-c0xffffffff-no-rj-mo',
    url: 'https://www.youtube.com/channel/UC0gEw6pgNkLkkzMwzX4UtHA'
  },
  uploadDate: 'Published on Apr 19, 2019',
  viewCount: 5163653,
  likeCount: 185816,
  dislikeCount: 3154,
  tags: []
}
SuspiciousLookingOwl commented 4 years ago

I don't think this is possible, since there's no thumbnail when you opening the watch page, i will double check again.

SteeledSlagle13 commented 4 years ago

ah that makes sense. I appreciate the speedy response!!!

SteeledSlagle13 commented 4 years ago

i think i can work around it by

scrapeYt.search("4itm0SRxAro", {type: "video"}).then(videos => {
    console.log(videos[0]);
});

still testing but i looks like the search is pulling up the video by the id ill touch base again in a few minutes

SuspiciousLookingOwl commented 4 years ago

From my experience, searching with videoID isn't 100% accurate, sometimes it gives different result

SteeledSlagle13 commented 4 years ago

looks like if i put the id in the form of the watch url i can get it with search!!!!

just putting the id doesnt return videos that have less than a certain amount of views from what it looks like

'https://www.youtube.com/watch?v=njTMhgn96H0' brings up the video while 'njTMhgn96H0'

brings up some random videos

SteeledSlagle13 commented 4 years ago

gotta keep finding videos with less that 1k views to see what the limit is

SteeledSlagle13 commented 4 years ago

hmmmm might not be 100% based on view count.... i think that is a big factor but it could also relate to the tags/category of the video

but using the link over the id has been working

SteeledSlagle13 commented 4 years ago

its not an issue XD especially on your end... if the watch page doesnt have the thumbnail then it doesnt have it so eh.

ill keep posting my findings with the search here

SuspiciousLookingOwl commented 4 years ago

i think it might have thumbnail, when you first opened the watch page before the video starts loading, i think it's showing thumbnail first, i will check later.

SteeledSlagle13 commented 4 years ago

sounds good ty

SuspiciousLookingOwl commented 4 years ago

Turns out i was wrong, indeed there is a thumbnail. Not gonna publish any update to NPM right now, going to see if i can get more useful information from getVideo and other functions, if you have any suggestion for additional information to add, please send them here!

SteeledSlagle13 commented 4 years ago

will do! thank you so much!

SuspiciousLookingOwl commented 4 years ago

Added on @1.2.4!