yt-search's People
Forkers
chitoadinugraha littlelotta ceddybi nightscript370 sebastianoscarlopez coalsephos hmz06967 vantinh689 xatuke tnstiger mattez02 gustavobonassa terror-machine cloudeddragon yareyaredesuyo supergrov3r xakiru duccyf chungminhtu lightninbolt986 aliaryantech alien-alfa teamolduser xjhowxjhow nugraizy mizizaki ranjitkshahyt-search's Issues
Fetch chapters when it's vailable
It would be nice to fetch chapters when it's available in the video.
Versioning scheme?
Hi,
First of all: Nice project, thanks for your work.
Working good so far but I have one question:
What is your versioning scheme?
If you don't have one, I would strongly suggest using Semantic Versioning
Playlist metadata with 100+ videos
Currently getting playlist metadata of a playlist id is capped at 100 videos even if the playlist has more than 100 videos in it. This is because ytInitialData
only includes the first 100 videos in the playlist.
This issue is to track/discuss if or how this library should handle this case.
related issue: #44
Video description not keeping the \n
When searching for videos and looking at one's description
attribute, we can see the line feeds are not kept. They are instead replaced with spaces. Is it the expected behavior, and if so, how to get the original description with the line feeds?
All of a sudden not responding with the list of videos causing an error
Without changing my working code I am now getting an error, after looking into it I tried to log the callback I was receiving from the YTS library and the videos were empty. Just wondering if this is an issue on the library end of things? Thanks
cannot file module on dist/yt-search. js
on package. json your main file is yt-search. js
so when i run the command it crashed bec yt-search. js is missing so i hope youll fixed this asap
Invalid video appearing in search results
When performing a search, occasionally a video appears at the top of the results that’s invalid. Its videoId
field isn’t a valid video ID, the ago
property lists views, and the views
, duration
, and seconds
properties are zeroed.
Here I searched for "test" a few times and this video was prepended to the results. (Notice how there are 21 elements in the array instead of 20.)
Unfortunately, I can't find a way to reliably reproduce the error, it only happens occasionally.
My current work-around is to filter the results for the weird ID (which seems to be invariant).
ytSearch({
query: searchQuery,
pageStart: searchPage,
pageEnd: searchPage + 1
}, function(err, results) {
results = results.filter(r => r.videoId !== 'L&ai')
// Rest of code
})
Playlist metadata by id - getting 400: Cannot read property 'split' of undefined
I tried several different playlist IDs but I always get 400 Bad Request, and the message says "Cannot read property 'split' of undefined".
I suspect a dependency changed which caused a regression?
Cannot read property 'hostname' of undefined
hi a new issue. Code:
s.getTrack(
some spotify track id
)
.then(async function (data) {
let trackname =${data.artists[0].name} - ${data.name}
let result = await yts(trackname)
console.log(result)
}, function (err) {
console.error(err);
});
Error:
(node:15672) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'hostname' of undefined at e (C:\Users\asd\OneDrive\Masaüstü\deneme\node_modules\dasu\dist\dasu.min.js:1:513) at Object.t [as req] (C:\Users\ocaku\OneDrive\Masaüstü\deneme\node_modules\dasu\dist\dasu.min.js:1:5491) at c (C:\Users\asd\OneDrive\Masaüstü\deneme\node_modules\yt-search\dist\yt-search.min.js:1:6831) at i (C:\Users\asd\OneDrive\Masaüstü\deneme\node_modules\yt-search\dist\yt-search.min.js:1:7656) at r (C:\Users\asd\OneDrive\Masaüstü\deneme\node_modules\yt-search\dist\yt-search.min.js:1:1591) at new Promise (<anonymous>) at i (C:\Users\asd\OneDrive\Masaüstü\deneme\node_modules\yt-search\dist\yt-search.min.js:1:1565) at t.exports (C:\Users\asd\OneDrive\Masaüstü\deneme\node_modules\yt-search\dist\yt-search.min.js:1:12159) at C:\Users\asd\OneDrive\Masaüstü\deneme\commands\music\play.js:72:36 at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:15672) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3) (node:15672) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
{ videoId: id } search doesn't recognise "#" in title
I've noticed that the resulting video object from yt-search({ videoId: id})
removes any part of the title at and after a #
-symbol.
When running this code
const yts = require('yt-search');
main();
async function main() {
const videoIdSearch = await yts({ videoId: process.argv[2] });
const res = await yts(process.argv[2]);
console.log(videoIdSearch.videoId === res.videos[0].videoId);
console.log(videoIdSearch.title);
console.log(res.videos[0].title);
}
We get the result:
user@system $ node test z95fi3uazYA
true
Dragon Ball Z Abridged: Episode 60 - Part 3 -
Dragon Ball Z Abridged: Episode 60 - Part 3 - #DBZA60 | Team Four Star (TFS)
Query retrun one result
I just want a query return only one video detail (not use video[0]). Is it posible and how to do it?
pageEnd doesn't seem to work
Having pageEnd: 1
and pageEnd: 10
return the same amount of videos.
await ytSearch({
query: `superman`,
pageStart: 1,
pageEnd: 10
})
both return 19 videos for me.
P. S. thanks for this lib!
videoId is undefined sometimes
Hello, I am using a music artist name + song + "official music video" as the search query to yts. I understand that I have to access the video property of the results object, and index to the first element
Some songs are able to scrape the videoId and thumbnail, while some songs cannot. I don't think I am able to replicate which songs are causing this error since I am looping through 220 songs.
I am storing this data onto a database, so videoId and coverImage are fields that are populated when I scrape data from your API
This is my code (artist and title work fine):
Thank you for any clarification
Callback is not a function (Discord.js)
When I run this code, I get an error saying "TypeError: callback is not a function" on "callback(err);". I'm not sure if it is a problem with my code or yt-search, but I got my code straight from a YouTube video and there weren't any people complaining.
is there a way to sort by relevance?
i think the bot is sorting by views because I put in a specific title and it didn't show up (small # of views). can I sort by relevance? or does it just use youtube's search with no filters?
When i search thai song it will show this error
err :https://pastebin.com/vPZqFhQV
How to fix
Not showing all videos
Refused to set unsafe header [...] "accept-encoding"
I am using the single video search mode using a video ID.
Here is a snippet of my code.
var videoInfo = await yts({ videoId: v })
vidTitle = videoInfo.title
console.log(videoInfo)
songname.innerText = vidTitle;
When I do that, it returns the following error:
Refused to set unsafe header {My Directory Path} "accept-encoding"
I am using this in an Electron Renderer process if this helps.
Cannot find module dasu
Hi, I am experiencing an issue on vercel where it says in cannot find module dasu, I normally works locally. So it does not make sense. I am thinking its something to do the how that module is packaged.
Do you have any ideas?
Live streams showing up as videos!
Make it not so.
TypeError: Cannot read property 'split' of undefined
This seems to be something to do with Thumbnails
Code:
Example > id = "PL67B0C9D86F829544"
const list = await yts( { listId: id } )
Error:
at node_modules\yt-search\dist\yt-search.js:850:69
search throws http 302 and returns undefined
When using yt-search#search, it throws this string as an error "http status 302" (NOT as an error object)
playlist videos
can you add video duration to playlist videos?
{
title: '',
videoId: '',
listId: '',
thumbnail: '',
author: [Object]
},
that will be great if u add a duration object.
Accounts no longer show up in YouTube results
Seems like accounts/channels no longer show up as search results.
Previously some channels would show up in their own tile on the search results page. E.g. when searching for "pewdiepie" the pewdiepie channel would show up along with other video results.
Not sure how to handle this one. Either ignore it as YouTube evolves (as they are no longer showing up as a youtube search result) or alternatively add a non-standard way to gather account/channel data fro the video results that show up.
Leaning towards sticking with whatever youtube provides as standard and possibly leaving the account/channel results to be empty indefinitely as long as the initial youtube search result doesn't include them.
By looping through the videos you can still get a list of which channels are making the videos.
Vulnerability issue for yt-search for discord bot
Denial of service
Live not an option
Hello once again xD. You recently updated the library to not have live streams in the video results but when I attempted to get the new option 'live' it doesn't appear to be there on version 2.2.4.
Edit: Upon further testing and research it appears that it's just not auto filling.
Using with discord.js - undefined
Hello,
i have a issue when i use your module with discord.js.
Each time i try to use your function like that :
YoutubeStream.validateURL(args[1])
(args[1] = "astronaute" for example.)
It send me undefined in videos, list and playlist.
Could you help me ?
Thanks !
Abrichar
Mix (playlist) support.
A special kind of playlist called a "mix" (play list id's starting with RD
instead of PL
) is currently unsupported for various reasons.
A mix
playlist is unviewable on the /playlist
page. Mixes are also infinite and populated indefinitely by YouTube AI and are personal to whoever opens the playlist.
However, saved mixes usually have the first ~25 videos constant, and any other videos populated thereafter is random based on YouTube AI on the user listening to the mix.
This issue is to track/discuss how this library should handle this case.
Related issue: #43
video is undefined most of time
hello dev
60-70% time there is null result showing for us
Multi page/scroll results
Support for multiple page results.
I'm not sure I want to support this, but here is an issue to keep track/discussion about it.
similar: #7
Proxy?
Is there proxy support?
Cannot read property 'split' of undefined
TypeError: Cannot read property 'split' of undefined
at node_modules/yt-search/dist/yt-search.min.js:1:4926
This used to work but all of a sudden it stops working.
Seconds returning wrong
The library has a bug, when I get a video by id and it has 0 minutes, it returns the wrong seconds. For example: the video is 12 hours, 0 minutes, 1 second (12:00:01), it will return 720 seconds.
TypeError: Cannot read property 'videos' of undefined
I've fixed this error yesterday using npm install yt-search@latest
but today it reappeared
and this time I cannot fix it using npm i
this is my code :
const yts = require( 'yt-search' );
async function VideoUrl(nome){
if(isUrl(nome)){
const songInfo = await ytdl.getInfo(nome);
return new Promise((resolve, reject) => {
yts(songInfo.videoDetails.title, ( err, r ) => {
if (err){
reject(err);
}
const videos = r.videos
resolve({
title:videos[0].title,
url:videos[0].url,
duration:videos[0].timestamp,
image:videos[0].image
})
})
})
}else{
return new Promise((resolve, reject) => {
yts(nome, ( err, r ) => {
if (err){
reject(err);
}
const videos = r.videos
resolve({
title:videos[0].title,
url:videos[0].url,
duration:videos[0].timestamp,
image:videos[0].image
})
})
});
}};
const song =await VideoUrl(nome).catch(console.log)
FULL ERROR LOGS (I'm using heroku):
2020-08-23T13:43:44.767795+00:00 app[worker.1]: /app/commands/play.js:58
2020-08-23T13:43:44.767813+00:00 app[worker.1]: const videos = r.videos
2020-08-23T13:43:44.767813+00:00 app[worker.1]: ^
2020-08-23T13:43:44.767814+00:00 app[worker.1]:
2020-08-23T13:43:44.767814+00:00 app[worker.1]: TypeError: Cannot read property 'videos' of undefined
2020-08-23T13:43:44.767815+00:00 app[worker.1]: at /app/commands/play.js:58:32
2020-08-23T13:43:44.767815+00:00 app[worker.1]: at /app/node_modules/yt-search/dist/yt-search.min.js:1:7571
2020-08-23T13:43:44.767815+00:00 app[worker.1]: at i (/app/node_modules/dasu/dist/dasu.min.js:1:4168)
2020-08-23T13:43:44.767816+00:00 app[worker.1]: at Gunzip.<anonymous> (/app/node_modules/dasu/dist/dasu.min.js:1:2627)
2020-08-23T13:43:44.767816+00:00 app[worker.1]: at Gunzip.emit (events.js:327:22)
2020-08-23T13:43:44.767816+00:00 app[worker.1]: at endReadableNT (_stream_readable.js:1220:12)
2020-08-23T13:43:44.767817+00:00 app[worker.1]: at processTicksAndRejections (internal/process/task_queues.js:84:21)
I've also tryied to run my discord bot on localHost. Any Help?
I might be doing something wrong.
Searching for "Josh A & Jake Hill - Rest in Pieces (Lyrics)" or just the url itself "https://www.youtube.com/watch?v=_JzeIf1zT14" Will not find this video. Usually searching for a url puts it in the top 1-3 spots but this url doesn't work. I am not sure how to detail this or why this happens.
These URLs as well:
https://www.youtube.com/watch?v=_G6pGZJiCi8
https://www.youtube.com/watch?v=_P5P4_ISofI
https://www.youtube.com/watch?v=_X3qw3ytgTg // Provides nothing.
I am using the global version for them and my locally installed version and both are sending the same information.
Seems to be urls with the ID starting with '_'(underscore).
empty description attribute
Recently realised the description for every video appears to be empty now... Even the runkit you provided returns an empty description as well
Would be really thankful if this could be fixed
How to solve this error when trying to update this packages
`videoDetails.thumbnail.thumbnails` will be removed in a near future release, use `videoDetails.thumbnails` instead.
How to remove this warning videoDetails.thumbnail.thumbnails
will be removed in a near future release, use videoDetails.thumbnails
??????
Each time I use yt-search , this warning is coming on console.
Video.url Shows up undefined
yts(searchterm, function ( err, r ) {
let video = r.videos;
console.log(video.url);
let Fvideo = video[0];
let URL = Fvideo.url;
return URL;
});
I want to be able to see the video's url. How would I go about doing that since video.url is undefined? All help greatly appreciated.
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'join' of null
error when using plalylist with id
id playlist : PLSwcuYF4r6MJHkUVYbDAekT7j0FvZ_B4X
Error: Cannot find module 'cheerio' using create-react-app and webpack
Using create-react-app, webpack and the default config as well as the following code :
import YTSearch from "yt-search";
async function debug() {
console.dir(await YTSearch("some video"));
}
debug();
I got the following error : Error: Cannot find module 'cheerio' with the stack:
Uncaught Error: Cannot find module 'cheerio'
s yt-search.min.js:1
s yt-search.min.js:1
./node_modules/yt-search/dist/yt-search.min.js/</<[1]< yt-search.min.js:1
s yt-search.min.js:1
r yt-search.min.js:1
js yt-search.min.js:1
js yt-search.min.js:1
js yt-search.min.js:1
Webpack 15
yt-search.min.js:1
Any idea how to fix that issue? I'm using typescript but the issue is style present with vanilla javascript.
Cannot read property 'replace' of undefined
I'm getting a "Cannot read property 'replace' of undefined" and none of the directories lead back to my app file which makes me think YouTube have released another update sadly
playlist metadata inconsistent
This issue is to track recent inconsistencies for playlist metadata ytInitialData
results.
It seems that some youtube servers are returning inconsistent playlist metadata in the ytInitialData
.
I'm not sure why this is.
Example: https://www.youtube.com/playlist?list=PL7k0JFoxwvTbKL8kjGI_CaV31QxCGf1vJ sometimes returns a playlist of only 5 videos instead of the 9 that it currently has.
The videos not present in the inconsistent ytInitialData response are:
The Max Fleischer Cartoon (From "Superman)
[Deleted Video]
[Private Video]
Hans Zimmer - Man of Steel Theme
video id's of these are:
https://www.youtube.com/watch?v=IQtKjU_pOuw&list=PL7k0JFoxwvTbKL8kjGI_CaV31QxCGf1vJ&index=1
https://www.youtube.com/watch?v=g1PjuAq-ua0&list=PL7k0JFoxwvTbKL8kjGI_CaV31QxCGf1vJ&index=2
https://www.youtube.com/watch?v=Br_8B1exfm8&list=PL7k0JFoxwvTbKL8kjGI_CaV31QxCGf1vJ&index=4
https://www.youtube.com/watch?v=EngKxF3Cqh4&list=PL7k0JFoxwvTbKL8kjGI_CaV31QxCGf1vJ&index=8
TypeError: Cannot read property 'split' of undefined
I search "王菲",console show TypeError: Cannot read property 'split' of undefined.
like "王菲", "菲王", "王非", "非王" still show TypeError.
but search "王" or "菲" is ok.
video unavailable
I often say that one day I can search for everything I want, and the next day I can find absolutely nothing because I have error: video unavailable. Unfortunately, I have no ideas what to do.
version: 2.1.3
Results are undefined
I've tried this package and other ones but there all returning undefined/no results.
Did youtube update there api or is this part of that youtube download thingy thats going arround on the news.
Search return empty results
Hi,
Since this morning searching items does not work anymore. Resultset is always empty.
`const yts = require( 'yt-search' )
yts( 'superman theme', function ( err, r ) {
if ( err ) throw err
const videos = r.videos
videos.forEach( function ( v ) {
const views = String( v.views ).padStart( 10, ' ' )
console.log( ${ views } | ${ v.title } (${ v.timestamp }) | ${ v.author.name }
)
} )
} )`
--> no output
TypeError: Cannot read property 'split' of undefined
I have the same error that the issue #27, but this happens when I try to search this list Id: RDGMEM_v2KDBP3d4f8uT-ilrs8fQ&
Code:
let result = await yts({ listId: "RDGMEM_v2KDBP3d4f8uT-ilrs8fQ&" });
Error:
[nodemon] restarting due to changes...
[nodemon] starting `node index.js`
Bot encendido
TypeError: Cannot read property 'split' of undefined
at _parsePlaylistInitialData (/Users/fidel/discord-bot-php/js/node_modules/yt-search/dist/yt-search.js:812:63)
at /Users/fidel/discord-bot-php/js/node_modules/yt-search/dist/yt-search.js:792:9
at i (/Users/fidel/discord-bot-php/js/node_modules/dasu/dist/dasu.min.js:1:4168)
at Gunzip.<anonymous> (/Users/fidel/discord-bot-php/js/node_modules/dasu/dist/dasu.min.js:1:2627)
at Gunzip.emit (events.js:315:20)
at endReadableNT (internal/streams/readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
Results come back as undefined
I am using similar code to the easy to use section (https://github.com/talmobi/yt-search#easy-to-use)
However each time it returns the results, they come back as undefined..
I made sure I am using the latest version of yt-search, using 'npm install yt-search@latest'
Is there any way to solve this?
Limit for Returning Data
It will be cool to pass { limit: 1 }
while searching to get only the first video without extra network overload.
Not sure if its possible.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.