bakapear / ytt Goto Github PK
View Code? Open in Web Editor NEWYouTubeTools
License: MIT License
YouTubeTools
License: MIT License
This module works very well for node.js but if you try to use it under electron/nw.js it throws an error which makes it unusable:
Example (using Nw.js or Electron) :
var ytt = require("ytt");
ytt.playlist('PLCxjFBEyIgt1FmIYPZrodi19Vv_Z8K9LJ', true) // or any other method except "format" method
it throws :
Uncaught (in promise) TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type Function. Received type object
For some reason I get this error and I don't know why. Error;
Error: connect ECONNREFUSED 127.0.0.1:443
How to solve?
Hello, I realize that the util.parse function leads to errors, because some scrapped pages does not contain window["ytInitialData"] =
, but var ytInitialData =
instead.
So consider the following parse
function solves my error:
parse: x => main.between(x, 'var ytInitialData = ', '};', 1)
Is it possible to support the both alternatives ?
Uncaught Promise Rejection Error: Not an ID: 'PL4E1AE167C56AA012' at Object.error (/rbd/pnpm-volume/443e9cdc-4277-44b6-bfe1-27aff93692ed/node_modules/.registry.npmjs.org/ytt/2.0.5/node_modules/ytt/src/lib/util.js:3:15) at Object.module.exports [as valid] (/rbd/pnpm-volume/443e9cdc-4277-44b6-bfe1-27aff93692ed/node_modules/.registry.npmjs.org/ytt/2.0.5/node_modules/ytt/src/valid.js:11:27)
Really nice package, but i have "Not an ID" error when trying to get videos from playlists with...hm, "old type" id. For example, 'PL4E1AE167C56AA012', 'PL508A218FC66DAD72'.
Code example (working):
let playlist = await ytt.playlist('PLDfKAXSi6kUareOEtT2PsmWMmWVOWOs4x', { full: true }) if(playlist.items.continuation) await playlist.items.more() console.log(playlist.items.length)
Url: "https://www.youtube.com/watch?v=Shk7qcvqDOo&list=PLDfKAXSi6kUareOEtT2PsmWMmWVOWOs4x"
(not working. Will give "not an id" error):
let playlist = await ytt.playlist('PL4E1AE167C56AA012', { full: true }) if(playlist.items.continuation) await playlist.items.more() console.log(playlist.items.length)
Url: "https://www.youtube.com/playlist?list=PL4E1AE167C56AA012"
Sup.
On some videos id, "video" method gives error.
Videos example:
https://www.youtube.com/watch?v=HA8JI1vM2FA
https://www.youtube.com/watch?v=MTvUCo0h8PI
Code example:
async function test() { let video = await ytt.video('HA8JI1vM2FA') console.log(video) } test()
Error:
(node:400) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'simpleText' of undefined at Object.text ("your project"/node_modules/ytt/src/lib/util.js:16:66) at Object.makeVideoObject ("your project"/node_modules/ytt/src/lib/builder.js:114:35) at Object.module.exports [as video] ("your project"/node_modules/ytt/src/video.js:9:23) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async Client.<anonymous> ("your project"/Test/main.js:1473:13)
Hello,
First of all, thank you for this amazing package.
I discover some problems using the query method. The following queries lead to empty result, which is not the case in YT:
The case 1. is maybe related to the fact that an album is attached to the answer. The case 2. may be caused by the quotes.
search.items.continuation
is always false:
let search = await ytt.query('ducks making very weird noises')
console.log(search.items.length) // 20
if (search.items.continuation) await search.items.more()
console.log(search.items.length) // 20
Because continuations[0].nextContinuationData.continuation
does not exist anymore:
Line 57 in 5c8c634
Line 268 in 5c8c634
We could replace it with continuationItemRenderer.continuationCommand.token
, however currently it gives the same items back and not the next ones.
Scrolling down the YouTube results page reveals that they've changed the way results get fetched.
The request uses the offical YouTube API now and requires an API key.
(disable_polymer not working anymore either)
Looking for possible workarounds...
(playlist continuation works fine though, because a continuations object is provided)
For example, videos video1, video2 gives error
Checking video with await ytt.valid(video_id)
gives true
Searching videos with await ytt.query('search text', { filter: 'video', num: 20 })
and finding that video is ok
But when trying to use await ytt.video(video_id)
, it gives error
TypeError: Cannot read property 'accessibilityData' of undefined at Object.makeVideoObject (/project/node_modules/ytt/src/lib/builder.js:107:125) at Object.module.exports [as video] (/project/node_modules/ytt/src/video.js:9:23)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.