Closed moneill6720 closed 4 years ago
Interesting, just tested the same channel and it's working as expected, I had this happen one time when I ran without NPM (causing dotenv to not be loaded properly), so please double check if your Client ID is correct and make sure your are running with npm run start
.
Later today I'll release a small update to dump the entire request body when this happens, I'm not sure if Twitch responds with an error message.
still doesnt work. i have called the file ".env" and put a clientID that i got from my twitch developer api page what not and still throws the same error i also use the npm run start. a friend looked at it and apparently found that the api module was coming back with errors?
I got it working using a request library called got to call the api manually since right now the module only uses the api for getting clip data.. It isn't error proof in the slightest and the implementation in index.js
has to be changed very slightly but oh well.
const got = require("got").default;
const api = got.extend({
prefixUrl: "https://api.twitch.tv/kraken",
headers: {
"Accept": "application/vnd.twitchtv.v5+json",
"Client-ID": process.env.CLIENT_ID
},
responseType: "json",
resolveBodyOnly: true,
});
module.exports = {
clips: {
/**
* @param {object} options The options for the thing
* @param {string} options.channel The channel the clips originate from
* @param {"all" | "day" | "week" | "month"} options.period The period of time to filter the clips by
* @param {number} options.limit The max number of clips to get
* @param {string} options.cursor The place to start reading clips from
*/
top: function(options) {
return api({
url: "clips/top",
searchParams: options,
})
}
}
}
That's weird, any idea what is causing this error?
The only reason I used the package is because it was the quickest route to make this work. But even after checking it's source-code, I don't see why it would be causing any errors. But I don't mind replacing it, if it's somehow causing this problem.
I just released an update to better debug this @moneill6720. You just have to update the index.js
and please update your .env to DEBUG=true
, it should dump the request in your screen.
Anyway you can send me your client ID To test it with?
On Tue, 9 Jun 2020 at 17:18, Hugo Jeller notifications@github.com wrote:
Interesting, just tested the same channel and it's working as expected, I had this happen one time when I ran without NPM (causing dotenv to not be loaded properly), so please double check if your Client ID is correct and make sure your are running with npm run start.
Later today I'll release a small update to dump the entire request body when this happens, I'm not sure if Twitch responds with an error message.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/HugoJF/twitch-clip-downloader/issues/1#issuecomment-641410603, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI7ERULJDW2C7YAYOH4WHGDRVZOGVANCNFSM4NZNNEIQ .
@moneill6720 try again using the latest version with your Client ID and provide me the output just to make sure it's something with the API.
Then try using this Client ID: zycmvtukn9b23fotpej708cuzlf9at
EDIT: Ok, just noticed very stupid problem I'm not sure how it's not happening to you. That thedist/Twitch_API_v5
package is for some reason is accessing the V4 API, causing a [code 410]: Gone this API has been removed
as per #2. That's why I wanted to replace it with axios
.
@eyrewiut thanks for the code, I actually quickly ported to axios
since got
refused to work (have no idea why, just gave up because of time). I might clean it up a bit once I have some free time.
@moneill6720 Please download the new version, delete node_modules
, install everything again and try again.
Please let me know if this fixed it.
@HugoJF hmm, clean install, script found clips and:
✔ Found 1089 clips to download, download now? … yes ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 0% | ETA: 0s | 0/1089(node:19808) UnhandledPromiseRejectionWarning: ' at Object.openSync (fs.js:461:3) at Object.writeFileSync (fs.js:1387:35) at /home/ttv/index.js:43:12 at new Promise (<anonymous>) at downloadClip (/home/ttv/index.js:28:12) at /home/ttv/node_modules/tiny-async-pool/lib/es7.js:18:44 at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async asyncPool (/home/ttv/node_modules/tiny-async-pool/lib/es7.js:23:7) (Use
node --trace-warnings ...` to show where the warning was created)
(node:19808) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by th)
(node:19808) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise.
events.js:292
throw er; // Unhandled 'error' event
^
Error: ESOCKETTIMEDOUT
at ClientRequest.node -r dotenv/config index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the clips-downloader@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
`
I wonder if Object.writeFileSync
was causing by not having the full directory path. Try creating a clips
directory where index.js
is.
I planned on automatically creating this, but forgot about it.
hello this is the new issue on the new recent update you did with this issue
hello this is the new issue on the new recent update you did with this issue
i has the same issue on mac os.
how strange any idea what the problem could be ?
with the las update in the git-ignore it fixed.
@moneill6720 This error is occuring because I uploaded my own token to GitHub, so instead of generating a new one, from your application, is used your Client ID and my OAuth token.
I filtered this file from each commit, and should be fixed.
Please let me know if this fixes everything.
I'll be closing this issue since the reason it got opened was already resolved and it's not even relevant for the current version.
If you encounter any bugs, feel free to open a new issue!
it doesnt work this happens