SuspiciousLookingOwl / youtubei

Get Youtube data such as videos, playlists, channels, video information & comments, related videos, up next video, and more!
https://suspiciouslookingowl.github.io/youtubei
MIT License
240 stars 50 forks source link

add features options on search method #60

Closed wweevv-johndpope closed 2 years ago

wweevv-johndpope commented 2 years ago
Screen Shot 2022-08-11 at 3 48 19 pm

I basically want to dig up live videos - is it possible? how? it seems like this is a private api? does this key match AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8 live videos for australia? how can I use this to get results?

curl 'https://www.youtube.com/**youtubei**/v1/browse?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8&prettyPrint=false' \

wweevv-johndpope commented 2 years ago

all these don't work - is it a private api collection?


    const result = await youtube.getVideo("AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8");

    const result = await youtube.getChannel("AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8");

    const result = await youtube.getPlaylist("AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8");
SuspiciousLookingOwl commented 2 years ago

This is not possible at the moment. altough should be possible and easily implemented by adding features options on .search() method, like youtube does on the search page image

wweevv-johndpope commented 2 years ago

superficially - are you saying - we just need to pass more parameters here? It seems youtube has closed this off - or its not documented...

Screen Shot 2022-08-13 at 9 38 28 am

I don't fully understand what this code is doing seems like it discriminates results after searching.... but that's not quite what I want... https://github.com/fan87/wd-musicbot/blob/20745af23e3f620f879caf85b134f9bd227c4c9e/src/youtube/YoutubeAPI.py

Found this https://serpapi.com/playground?engine=youtube&search_query=Coffee&gl=au

Screen Shot 2022-08-13 at 10 20 14 am

maybe just need the parameter name and pass it into sp value?

UPDATE - oh it worked!!!

EgJAAQ%253D%253D https://www.youtube.com/results?search_query=&sp=EgJAAQ%253D%253D

UPDATE found this

https://github.com/vlad-terin/my-surfingkey-config/blob/56e5cf9f549681783ff5484cea1fd9a8252a48e7/surfingkeys-config.js

// youtube youtubeBase = "https://www.youtube.com/results?search_query={0}", youtubeChannel = youtubeBase + "&sp=EgIQAg%253D%253D", youtubePlaylist = youtubeBase + "&sp=EgIQAw%253D%253D", youtubeMovie = youtubeBase + "&sp=EgIQBA%253D%253D", youtubeShow = youtubeBase + "&sp=EgIQBQ%253D%253D", youtubeShort = youtubeBase + "&sp=EgIYAQ%253D%253D", youtubeLong = youtubeBase + "&sp=EgIYAg%253D%253D", youtubeLive = youtubeBase + "&sp=EgJAAQ%253D%253D", youtube4k = youtubeBase + "&sp=EgJwAQ%253D%253D", youtubeHD = youtubeBase + "&sp=EgIgAQ%253D%253D", youtubeSubtitles = youtubeBase + "&sp=EgIoAQ%253D%253D", youtubeCreativeCommons = youtubeBase + "&sp=EgIwAQ%253D%253D", youtube360 = youtubeBase + "&sp=EgJ4AQ%253D%253D", youtubeVR = youtubeBase + "&sp=EgPQAQE%253D", youtube3d = youtubeBase + "&sp=EgI4AQ%253D%253D", youtubeHDR = youtubeBase + "&sp=EgPIAQE%253D", youtubeLocation = youtubeBase + "&sp=EgO4AQE%253D", youtubePurchased = youtubeBase + "&sp=EgJIAQ%253D%253D", youtubeUploadDate = youtubeBase + "&sp=CAI%253D", youtubeViewCount = youtubeBase + "&sp=CAM%253D", youtubeRating = youtubeBase + "&sp=CAE%253D",

This looks like it's working - https://github.com/hansputera/youtube-finder/blob/3777d3e1955a5b13e930ad94e8f366d1a7073a71/scraper.py

SuspiciousLookingOwl commented 2 years ago

I've added features on search options

client.search("foo", {
    type: "video",
    features: ["live"],
}

It will be available on next version

johndpope commented 2 years ago

Cool thank you 🙏

SuspiciousLookingOwl commented 2 years ago

Available on 1.0.0-rc.5