D3vl0per / Twitch-watcher

Automatic watching the twitch to get Valorant drop
MIT License
227 stars 69 forks source link

+ Ability to set priority channels and to always watch top streamer #84

Closed tetreum closed 3 years ago

tetreum commented 3 years ago

docker-composer.yaml new env vars example:

      - watchAlwaysTopStreamer=true
      - channelsWithPriority=illojuan,alexby11,aroyitt

Having both vars set, the app will prioritize the channels and then the top streamer. It's a good fallback as usually the top streamer has drops enabled too.

If user updates the channel list, he will have to run: docker-compose up -d valorant-watcher

In order to recreate the container.

RFBomb commented 3 years ago

This change isn't working.

Here is my config:

version: '2'
services:
  valorant-watcher:
    image: d3vm/valorant-watcher:latest
    restart: always
    environment:
      - token=[Redacted]
      - streamersUrl=https://www.twitch.tv/directory/game/Warframe?sort=VIEWER_COUNT
      - watchAlwaysTopStreamer=true
      - channelsWithPriority=warframe,neoness007,aroyitt
      - userAgent=Mozilla/5.0 (Linux x86_64) #- userAgent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36
      - scrollDelay=2000
      - scrollTimes=5
      - minWatching=35
      #- maxWatching=15
      - streamerListRefres=15
      - streamerListRefreshUnit=minute
      #- browserScreenshot=false
      #- proxy=ip:port
      #- proxyAuth=username:password
    #volumes:
    #  - "./screenshots:/usr/src/app/screenshots"

Here is my log from the container:

,
> valorant-watcher@2.0.4 start /usr/src/app,
> node app,
,
=========================,
๐Ÿ”Ž Checking config file...,
โœ… Env config found,
=========================,
๐Ÿ“ฑ Launching browser...,
๐Ÿ”ง Setting User-Agent...,
๐Ÿ”ง Setting auth token...,
โฐ Setting timeouts...,
=========================,
๐Ÿ” Checking login...,
โœ… Login successful!,
๐Ÿ“ก Checking active streamers...,
๐Ÿ”จ Emulating scrolling...,
๐Ÿงน Filtering out html codes...,
=========================,
๐Ÿ”ญ Running watcher...,
,
๐Ÿ”— Now watching streamer:  https://www.twitch.tv/celebi,
๐Ÿ”ง Setting lowest possible resolution..,
๐Ÿ’ก Account status: Online,
๐Ÿ•’ Time: 00:38:36,
๐Ÿ’ค Watching stream for 34 minutes,
,

Top Streamer at the time of testing: AlainLove I had the Next highest streamer in my priority list: neoness007 it chose a random one instead.

tetreum commented 3 years ago

@RFBomb did you rebuild the container after adding the list? Did you check that your container has the lastest code? I'm using this code since rust started it's drops months ago.

RFBomb commented 3 years ago

Since the container did not do what I wanted it a while back, i had deleted the image. So when I built the portainer stack yesterday, it would have downloaded the latest image, which is what gave the results listed in my post.

Either way, my side of things is resolved because I published a fork of this project that uses Twitch's HELIX api to evaluate which priority streamers are online. I also included the ability to sleep if no priority streamer is online.

On Sat, Feb 13, 2021 at 3:41 AM tetreum notifications@github.com wrote:

@RFBomb https://github.com/RFBomb did you rebuild the container after adding the list? Did you check that your container has the lastest code? I'm using this code since rust started it's drops months ago.

โ€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/D3vl0per/Twitch-watcher/pull/84#issuecomment-778584734, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE34HF62TRN4XGJMRPOCIYLS6Y3KXANCNFSM4WGACK3A .

RFBomb commented 3 years ago

Plus, as can be seen in my posted log, here is the version number: valorant-watcher@2.0.4, which appears to be the latest version.

tetreum commented 3 years ago

Sorry but 2.0.4 is from 2020. This PR got merged just 10 days ago :( You image does not contain this PR changes.

RFBomb commented 3 years ago

Ok, well the notes on the files in the GitHub still display 2.0.4 from what I can see. Plus, since I pulled the image yesterday the problem still stands.

On Sat, Feb 13, 2021 at 8:44 AM tetreum notifications@github.com wrote:

Sorry but 2.0.4 is from 2020. This PR got merged just 10 days ago :( You image does not contain this PR changes.

โ€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/D3vl0per/Twitch-watcher/pull/84#issuecomment-778621594, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE34HFYF7Y6HC2HKFZJDKMTS6Z65BANCNFSM4WGACK3A .

tetreum commented 3 years ago

That's strange because the latest one that i see is 2.0.5 in github: https://github.com/D3vl0per/Twitch-watcher/releases

Maybe docker hub autobuild didn't get triggered.

RFBomb commented 3 years ago

Package.Json still shows 2.0.4, which is why my container probably reported it as such.


{
  "name": "valorant-watcher",
  "version": "2.0.4",
  "description": "Automatic watching the twitch to get valorant drop",
  "main": "app.js",
  "scripts": {
    "start": "node app"
  },

https://github.com/D3vl0per/Twitch-watcher/blob/master/package.json

-- I literally just pulled the image down and this is what is posted in the container:

valorant-watcher@2.0.4 start /usr/src/app
> node app
=========================
๐Ÿ”Ž Checking config file...
โœ… Env config found
=========================
๐Ÿ“ฑ Launching browser...
๐Ÿ”ง Setting User-Agent...
๐Ÿ”ง Setting auth token...
โฐ Setting timeouts...
=========================
๐Ÿ” Checking login...
โœ… Login successful!
๐Ÿ“ก Checking active streamers...
๐Ÿ”จ Emulating scrolling...
๐Ÿงน Filtering out html codes...
=========================
๐Ÿ”ญ Running watcher...
๐Ÿ”— Now watching streamer:  https://www.twitch.tv/thebigbonk_

using this compose setup:

 valorant-watcher:
    #build: . #For local build
    #image: valorant-watcher:latest #For local build
    image: d3vm/valorant-watcher:latest
    restart: always
    environment:
      - token=[redacted]
      - streamersUrl=https://www.twitch.tv/directory/game/Warframe?sort=VIEWER_COUNT
      - watchAlwaysTopStreamer=true
      - channelsWithPriority=warframe,neoness007,sgtflexzzz
      - userAgent=Mozilla/5.0 (Linux x86_64) #- userAgent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36
      - scrollDelay=2000
      - scrollTimes=5
      - minWatching=35
      #- maxWatching=15
      - streamerListRefres=15
      - streamerListRefreshUnit=minute
      #- browserScreenshot=false
      #- proxy=ip:port
      #- proxyAuth=username:password

while the top 4 streams at that URL i wrote down are: angryunicorn doublexxf lordzephyrhs sgtflexzzz

so instead of choosing the streamer with the most viewer (meaning watchAlwaysTopStreameris broken as well), and instead of choosing one of the specified streamers, it chose the 21st person in the list.

Event setting it up with a single streamer in the preferred list, it didn't work. It chose person # 123 instead.

RFBomb commented 3 years ago

Judging that Dockerhub is showing Updated 9 months ago I believe it never triggered the autobuild. But package.json should probably be updated to match new version number anyway.

tetreum commented 3 years ago

Then that's the problem, until docker hub isn't triggered, no one will receive the new code. So no one has watchAlwaysTopStreamer & channelsWithPriority yet. I will send a PR upgrading package's version. If that gets merged maybe it triggers dockerhub.