Giter Club home page Giter Club logo

twitchdropgrabber's Introduction

Twitch Drop Grabber

Node.js application that watches Twitch streams and collects Drops. When the stream it's watching goes offline, it finds a new one. Great for running in the background: Set and forget.

READ THIS -- VERY IMPORTANT

Twitch has started to crack down on bots to farm drops. Therefore, as of right now, I've had to disable the claiming feature.

Instead, when a drop is found, it will be logged to the console with a link, so you can manually claim it.

I'm not sure if this will be permanent or not. I will try to implement a fix as soon as one has been found. If you have any ideas, feel free to open a pull request.


How to install/use

  1. Ensure you have a working installations of Node.js, npm and Google Chrome
  2. Clone the project
  3. Run npm install
  4. Run npm run build to compile the typescript files
  5. Set up the environment variables
  6. Start the project with npm start -- <GAME> where the game is your game of choice that currently has active drop campaigns. Replace <GAME> with the ID of the game in the Twitch directory. (e.g. https://twitch.tv/directory/game/fortnite)

More options are available, you can see these using npm start -- --help

Environment Variables

Two environment variables need to be set for this project. You can set these in whatever way you like. I prefer to use a .env file, see .env.example for an example.

The first variable you need to set are TWITCH_AUTH_TOKEN, which you can find by signing in to Twitch in your browser, and finding the auth-token cookie. Do NOT share this with others. This project will only run on your machine, and your auth token will therefore never leave your machine.

NOTE: In light of the recent Twitch leaks, do remember to change your password. This also refreshes your auth token so if the tool stops working, you need to replace it with the new token!

The second variable is TWITCH_CHROME_EXECUTABLE, which should point to your Chrome installation. Make sure this points to the actual application/executable file, and not just the install directory. If this path contains spaces, you can wrap it in quote symbols (e.g. "path goes here"). A good way to find this path is to open Chrome, browse to chrome://version/ and look under Executable Path

Disclaimer

I really just made this tiny project for my benefit and don't intend to actively maintain/make changes to it. It works for me and suits my needs. I have no concrete plans to add new features or improvements, however you are free to open pull requests or issues, and I might look at them in my free time.

I might also have some improvements in other branches that I haven't fully tested for myself yet. So you can always try a more 'experimental' branch if something isn't working.

There are some things that would be nice to have though. I might add these myself in the future, but if you feel like it's a fun waste of time, be my guest:

  • A better recovery for slow networks/networks failures
  • A better way of checking if streams are playing.
  • A way to detect channels you are watching going offline and hosting another channel
  • A way to check the channel that is being watched did not switch to a different game
  • An option to configure how many rewards you expect to claim (so the app can terminate once that is reached)
  • A way to detect a faulty auth token and provide feedback
  • Watch a list of certain streamers instead of searching for a channel

Feel free to suggest more.


This concludes what I've wanted to say. Maybe I forgot something, I don't know. Let me know by opening an issue.

I hope this project helps you :)

twitchdropgrabber's People

Contributors

alexsterk avatar devitcf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

twitchdropgrabber's Issues

是否能增加读取列表功能?

image

某些游戏只有指定的频道才会有掉落(比如RUST和Krunker等)
把所有指定掉落的用户名放入一个列表里 然后用 -l 或者--list 参数启动?

about add new feature

enable channel loop check <-l time><-loop time>
set a time to check whether the channel online, if online end loop and start watch

Stuck at "Finding online channel..." too

Thank you for making a very useful tool.I encountered some small problems during use.
I have seen this issue, but our problem is different.
I modified the url and added the log.
image
There is an online channel after using the browser to access the url
image
I used the -v command but it showed exactly the same output.
image

Will you help me with this problem? thanks

After a timeout occurs, the process neither exits nor continues to run

Hi!
I'm trying to run this on the server, but I find that I occasionally run into timeouts.
output:

[VERBOSE] [Wed, 17 Nov 2021 09:39:42 GMT] Trying warframe
[VERBOSE] [Wed, 17 Nov 2021 09:40:04 GMT] Current url: https://www.twitch.tv/warframe
[VERBOSE] [Wed, 17 Nov 2021 09:40:04 GMT] Channel status: offline
[VERBOSE] [Wed, 17 Nov 2021 09:40:04 GMT] Video duration: 2162.582302
[VERBOSE] [Wed, 17 Nov 2021 09:40:04 GMT] Channel live: false
[VERBOSE] [Wed, 17 Nov 2021 09:40:04 GMT] Channel offline, trying next channel
[Wed, 17 Nov 2021 09:40:04 GMT] No channels online! Trying again after the timeout
[VERBOSE] [Wed, 17 Nov 2021 09:45:04 GMT] Timer function called
[VERBOSE] [Wed, 17 Nov 2021 09:45:19 GMT] 0 claim buttons found.
[VERBOSE] [Wed, 17 Nov 2021 09:45:19 GMT] Current url: https://www.twitch.tv/warframe
[VERBOSE] [Wed, 17 Nov 2021 09:45:19 GMT] Channel status: offline
[VERBOSE] [Wed, 17 Nov 2021 09:45:19 GMT] Video duration: 2477.933973
[Wed, 17 Nov 2021 09:45:19 GMT] Channel offline
[Wed, 17 Nov 2021 09:45:19 GMT] Finding online channel...
[VERBOSE] [Wed, 17 Nov 2021 09:45:19 GMT] Trying warframe
(node:1710) UnhandledPromiseRejectionWarning: TimeoutError: Navigation timeout of 30000 ms exceeded
    at Promise.then (/var/local/TwitchDropGrabber/node_modules/puppeteer/lib/cjs/puppeteer/common/LifecycleWatcher.js:106:111)
(node:1710) 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(). (rejection id: 1)
(node:1710) [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.

async function runTimer(mainPage: Page, inventory: Page) {
vinfo('Timer function called')
await checkInventory(inventory);
await checkLiveStatus(mainPage);
setTimeout(runTimer, timeout, mainPage, inventory);
}

I'm not familiar with nodejs, I guess it's because an exception was thrown here, which caused the next timer to not be set?

about add this 3 new feature

"how many drops enabled online channel in this game"

&

"drops status"
image

&

"proxy support <-p ip:port>,<--proxy ip:port>"

running on a server, but time does not increase

image
i've been running this program for 2 hours,
(the screenshot is just a sample because i stopped it now, and just proving that i can run this program on my server.)
but sometimes the twitch status shows i'm not watching the stream, and the time does not increase, and i opened my chrome on windows and watched for 5mins, it increased, not twitch's problem, so, does this program not working on server?
image

Chrome is not able to start

[Mon, 18 Oct 2021 15:33:07 GMT] Starting application
(node:2244) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process! spawn <"C:\Program Files\Google\Chrome\Application\Chrome.exe"> ENOENT

I changed the TS File to add:

ignoreDefaultArgs: ['--disable-extensions'],

(index.ts) and build again. Just in case.

[Ubisoft's Problem]Claiming Drops issue

image
image
image
image

it seems Ubisoft's potato server just went down, and it effected other drops's claiming process, i just claimed the PUBG's twitch drop by myself
Is there a way to get all drops in rotation instead of getting stuck on uncollectable drops?

How to keep the value of auth token unchanged?

I extracted the auth token in chrome, but it will be invalid when I log out of twitch. When I log in again, a new auth token will be generated. How can I keep the value of auth token unchanged?

-p bug?

image
image
image

socks error / http ok

proxy use in
Qv2ray 2.7.0-pre2:6150 https://github.com/Qv2ray/Qv2ray
2021/04/17 05:54:11 tcp:127.0.0.1:13162 rejected proxy/socks: unknown Socks version: 67
2021/04/17 05:54:15 tcp:127.0.0.1:13167 rejected proxy/socks: unknown Socks version: 67
2021/04/17 05:54:18 tcp:127.0.0.1:13172 rejected proxy/socks: unknown Socks version: 67

Watching stream of multi-words games?

Script is running fine with 1-word games (fortnite, smite, valorant...) but I'm experiencing problems in games like "Black Desert Online". If i don't leave any space between words, this is what happens:
C:\TwitchDropGrabber-latest>npm start -- BlackDesertOnline

[email protected] start
node dist/index.js "BlackDesertOnline"

[Wed, 18 Aug 2021 13:55:46 GMT] Starting application
[Wed, 18 Aug 2021 13:55:47 GMT] Navigating to Twitch
[Wed, 18 Aug 2021 13:55:54 GMT] Configuring streaming settings
[Wed, 18 Aug 2021 13:55:54 GMT] Signing in using auth-token
[Wed, 18 Aug 2021 13:55:54 GMT] Finding online channel...

If i write with correct spaces, this i what happens:
C:\TwitchDropGrabber-latest>npm start -- Black Desert Online

[email protected] start
node dist/index.js "Black" "Desert" "Online"

C:\TwitchDropGrabber-latest\node_modules\command-line-args\dist\index.js:1345
throw err
^

UNKNOWN_VALUE: Unknown value: Desert
at commandLineArgs (C:\TwitchDropGrabber-latest\node_modules\command-line-args\dist\index.js:1342:21)
at Object. (C:\TwitchDropGrabber-latest\dist\index.js:46:12)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Function.Module._load (node:internal/modules/cjs/loader:828:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47 {
value: 'Desert'
}

bug

npm start -- Tom%20Clancy's%20Rainbow%20Six%20Siege→npm start -- Tom%20Clancys%20Rainbow%20Six%20Siege
(Clancy's→Clancys)

E_OD}I8`FDEK$LH1$CO6A

Correct code:npm start-Tom%20Clancy%27s%20Rainbow%20Six%20Siege
(Clancy's→Clancy%27s)
Y9MU)%H0E2@@7@1X`8P(OMH

Stuck at "Finding online channel..."

Thank you for making this utility.
The issue I met is whenever I start a twitch drop from CMD, it always ends up with "Finding online channel...". I know little about coding. Can you walk me through this? Thank you.

The internet is perfect.
image

Linux Support?

Hi there, I am quite interested in this repository however use a laptop that isn't online 24/7. I am wondering how I would go about, instead, installing this script on my Linux/Ubuntu VPS and just have it run 24/7? Since it needs a running Chrome.exe--I figured Puppeteer could just come with that for Linux but have no idea removing the need for the exe.

Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.