Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GraphQL instead of Helix API #288

Merged
merged 5 commits into from Oct 1, 2021
Merged

Use GraphQL instead of Helix API #288

merged 5 commits into from Oct 1, 2021

Conversation

Tkd-Alex
Copy link
Owner

@Tkd-Alex Tkd-Alex commented Sep 29, 2021

Description

The current Client-ID seems to don't work any more for the Helix API request.
Current workaround It's to use the GraphQL request to get streamer_id and followers list.

Fixes #281 #284 #292 #293

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality not to work as expected)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (README.md)
  • My changes generate no new warnings
  • Any dependent changes have been updated in requirements.txt

@Tkd-Alex Tkd-Alex added the bug Something isn't working label Sep 29, 2021
@Tkd-Alex Tkd-Alex linked an issue Sep 29, 2021 that may be closed by this pull request
@borzaka
Copy link

borzaka commented Sep 29, 2021

It's working for me, thank you!

image

@raymondcc2tm
Copy link
Contributor

raymondcc2tm commented Sep 29, 2021

Working perfectly for me as well. 🥳 Tested on ubuntu-64 bit. Copied the cookies from previous version to solve the login captcha issue.

@Equ1no0x
Copy link

Confirmed working for me as well. Win10 Pro 21H1 19043.1110
Only swapped the 3 files with new changes.
Thank you!
image

@Coldblackice
Copy link

Working for me, too, thanks. You're doing the lord's work 🙏

@sad1k
Copy link

sad1k commented Sep 29, 2021

thanks for quick answer it work!

@Tkd-Alex Tkd-Alex mentioned this pull request Sep 29, 2021
@Aure0
Copy link

Aure0 commented Sep 29, 2021

Thank you, it works but on the file TwitchChannelPointsMiner\classes\TwitchLogin.py, at line 183, there's a typo on "usrername"

@VitaliShilov
Copy link

do not work, just closed after few minutes

@Tkd-Alex
Copy link
Owner Author

do not work, just closed after few minutes

Can you say more about that?

@brendeni1
Copy link

Worked perfectly! Just copied cookies over and no issues. Thanks!

(I would also suggest everyone to do this for emoji support)

#259

@VitaliShilov
Copy link

do not work, just closed after few minutes

Can you say more about that?
20210929-223426.log

@Nakustix
Copy link

After a few mins i get this:

30/09 04:38:32 - Exception raised for topic: community-points-user-v1 and message: {'type': 'points-earned', 'data': {'timestamp': '2021-09-30T02:38:30.561978337Z', 'channel_id': '254735295', 'point_gain': {'user_id': 'xxxxxxxxxx', 'channel_id': 'xxxxxxxxx', 'total_points': 10, 'baseline_points': 10, 'reason_code': 'WATCH', 'multipliers': []}, 'balance': {'user_id': 'xxxxxxxxx', 'channel_id': 'xxxxxxxxx', 'balance': 570}}}
Traceback (most recent call last):
File "/data/data/com.termux/files/home/Twitch-Channel-Points-Miner-v2/TwitchChannelPointsMiner/classes/WebSocketsPool.py", line 182, in on_message
ws.streamers[streamer_index].persistent_series(
File "/data/data/com.termux/files/home/Twitch-Channel-Points-Miner-v2/TwitchChannelPointsMiner/classes/entities/Streamer.py", line 219, in persistent_series
self.__save_json("series", event_type=event_type)
File "/data/data/com.termux/files/home/Twitch-Channel-Points-Miner-v2/TwitchChannelPointsMiner/classes/entities/Streamer.py", line 234, in __save_json
json_data = json.load(open(fname, "r")) if os.path.isfile(fname) else {}
File "/data/data/com.termux/files/usr/lib/python3.9/json/init.py", line 293, in load
return loads(fp.read(),
File "/data/data/com.termux/files/usr/lib/python3.9/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/data/data/com.termux/files/usr/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/data/data/com.termux/files/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

No idea how python works. Kinda need help fixing

@Rakambda
Copy link
Contributor

This has probably nothing to do with this pr and has been answered several times in other issues. You seem to have corrupted analytics files.

@loki181920
Copy link

Hi. Can u explain the steps to fiz this issue? TKS

@Rakambda
Copy link
Contributor

There's a search features in the issues for a reason.
#266 among others

@loki181920
Copy link

There's a search features in the issues for a reason. #266 among others

sry but i dont understand anything about this XD
thats why i asked

@vykend
Copy link

vykend commented Sep 30, 2021

Works fine on Ubuntu 20.04 LTS, I've kept old cookies and run.py (just git checkout to other branch and everything is working it seems).

@Rafa-Alex
Copy link

is already working without any problem

@CappiSteijns
Copy link

CappiSteijns commented Sep 30, 2021

There's a search features in the issues for a reason. #266 among others

sry but i dont understand anything about this XD thats why i asked

You need to use this one: https://github.com/Tkd-Alex/Twitch-Channel-Points-Miner-v2/tree/wout-helix-api

@loki181920

@Rakambda
Copy link
Contributor

Rakambda commented Sep 30, 2021

There's a search features in the issues for a reason. #266 among others

sry but i dont understand anything about this XD thats why i asked

You need to use this one: https://github.com/Tkd-Alex/Twitch-Channel-Points-Miner-v2/tree/wout-helix-api

@loki181920

Not really. The issue he mentions (analytics Json issue) has nothing to do with this PR and is related to another issue that has been answered several times, hence the 266 I linked.

@loki181920
Copy link

loki181920 commented Sep 30, 2021

Tks im going to try

@EEEmill
Copy link

EEEmill commented Sep 30, 2021

I have "re-installed" and got this now.

30/09/21 17:43:31 - INFO - [run]: 😢 Streamer --- does not exist 30/09/21 17:43:31 - INFO - [run]: 😢 Streamer --- does not exist Traceback (most recent call last): File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\run2.py", line 65, in <module> twitch_miner.mine( File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\TwitchChannelPointsMiner.py", line 122, in mine self.run(streamers=streamers, blacklist=blacklist, followers=followers) File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\TwitchChannelPointsMiner.py", line 246, in run user_id=self.twitch.twitch_login.get_user_id(), File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\classes\TwitchLogin.py", line 214, in get_user_id return int(self.get_cookie_value("persistent").split("%")[0]) AttributeError: 'NoneType' object has no attribute 'split'

@Rakambda
Copy link
Contributor

I have "re-installed" and got this now.

30/09/21 17:43:31 - INFO - [run]: 😢 Streamer --- does not exist 30/09/21 17:43:31 - INFO - [run]: 😢 Streamer --- does not exist Traceback (most recent call last): File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\run2.py", line 65, in <module> twitch_miner.mine( File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\TwitchChannelPointsMiner.py", line 122, in mine self.run(streamers=streamers, blacklist=blacklist, followers=followers) File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\TwitchChannelPointsMiner.py", line 246, in run user_id=self.twitch.twitch_login.get_user_id(), File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\classes\TwitchLogin.py", line 214, in get_user_id return int(self.get_cookie_value("persistent").split("%")[0]) AttributeError: 'NoneType' object has no attribute 'split'

You're still using the master branch and not wout-helix-api.

@EEEmill
Copy link

EEEmill commented Sep 30, 2021

I have "re-installed" and got this now.
30/09/21 17:43:31 - INFO - [run]: 😢 Streamer --- does not exist 30/09/21 17:43:31 - INFO - [run]: 😢 Streamer --- does not exist Traceback (most recent call last): File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\run2.py", line 65, in <module> twitch_miner.mine( File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\TwitchChannelPointsMiner.py", line 122, in mine self.run(streamers=streamers, blacklist=blacklist, followers=followers) File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\TwitchChannelPointsMiner.py", line 246, in run user_id=self.twitch.twitch_login.get_user_id(), File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\classes\TwitchLogin.py", line 214, in get_user_id return int(self.get_cookie_value("persistent").split("%")[0]) AttributeError: 'NoneType' object has no attribute 'split'

You're still using the master branch and not wout-helix-api.

Ok, I have read something about it. Can you explain more what I should do with it? Just "install" it?
https://github.com/Tkd-Alex/Twitch-Channel-Points-Miner-v2/tree/wout-helix-api

@Rakambda
Copy link
Contributor

I have "re-installed" and got this now.
30/09/21 17:43:31 - INFO - [run]: 😢 Streamer --- does not exist 30/09/21 17:43:31 - INFO - [run]: 😢 Streamer --- does not exist Traceback (most recent call last): File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\run2.py", line 65, in <module> twitch_miner.mine( File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\TwitchChannelPointsMiner.py", line 122, in mine self.run(streamers=streamers, blacklist=blacklist, followers=followers) File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\TwitchChannelPointsMiner.py", line 246, in run user_id=self.twitch.twitch_login.get_user_id(), File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\classes\TwitchLogin.py", line 214, in get_user_id return int(self.get_cookie_value("persistent").split("%")[0]) AttributeError: 'NoneType' object has no attribute 'split'

You're still using the master branch and not wout-helix-api.

Ok, I have read something about it. Can you explain more what I should do with it? Just "install" it? https://github.com/Tkd-Alex/Twitch-Channel-Points-Miner-v2/tree/wout-helix-api

git clone https://github.com/Tkd-Alex/Twitch-Channel-Points-Miner-v2
cd Twitch-Channel-Points-Miner-v2
git checkout wout-helix-api

if the concept of branches isn't so familiar maybe it's better staying on master and wait that this is merged and just do a git pull then.

@borzaka
Copy link

borzaka commented Sep 30, 2021

With currently the latest wout-helix-api feature branch changes: Updating 5f6c755..3c31015

$ python run.py 
30/09 23:08:21 - 🌐  Analytics running on http://0.0.0.0:5000/
30/09 23:08:21 - 💣  Start session: 'xxx'
30/09 23:08:21 - 🤓  Loading data for 4 streamers. Please wait...
30/09 23:08:27 - 😴  xxx (49.21k points) is Offline!
30/09 23:08:28 - 😴  yyy (27.52k points) is Offline!
30/09 23:08:30 - 😴  zzz (11.38k points) is Offline!
30/09 23:08:31 - 😴  www (18.99k points) is Offline!
^C30/09 23:08:36 - CTRL+C Detected! Please wait just a moment!
Traceback (most recent call last):
  File "run.py", line 75, in <module>
    twitch_miner.mine(
  File "/home/xxx/Downloads/Twitch-Channel-Points-Miner-v2/TwitchChannelPointsMiner/TwitchChannelPointsMiner.py", line 122, in mine
    self.run(streamers=streamers, blacklist=blacklist, followers=followers)
  File "/home/xxx/Downloads/Twitch-Channel-Points-Miner-v2/TwitchChannelPointsMiner/TwitchChannelPointsMiner.py", line 227, in run
    time.sleep(30)
  File "/home/xxx/Downloads/Twitch-Channel-Points-Miner-v2/TwitchChannelPointsMiner/TwitchChannelPointsMiner.py", line 307, in end
    self.ws_pool.end()
AttributeError: 'NoneType' object has no attribute 'end'

@SnugglyFruit
Copy link

I have "re-installed" and got this now.
30/09/21 17:43:31 - INFO - [run]: 😢 Streamer --- does not exist 30/09/21 17:43:31 - INFO - [run]: 😢 Streamer --- does not exist Traceback (most recent call last): File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\run2.py", line 65, in <module> twitch_miner.mine( File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\TwitchChannelPointsMiner.py", line 122, in mine self.run(streamers=streamers, blacklist=blacklist, followers=followers) File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\TwitchChannelPointsMiner.py", line 246, in run user_id=self.twitch.twitch_login.get_user_id(), File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\classes\TwitchLogin.py", line 214, in get_user_id return int(self.get_cookie_value("persistent").split("%")[0]) AttributeError: 'NoneType' object has no attribute 'split'

You're still using the master branch and not wout-helix-api.

Ok, I have read something about it. Can you explain more what I should do with it? Just "install" it? https://github.com/Tkd-Alex/Twitch-Channel-Points-Miner-v2/tree/wout-helix-api

git clone https://github.com/Tkd-Alex/Twitch-Channel-Points-Miner-v2
cd Twitch-Channel-Points-Miner-v2
git checkout wout-helix-api

if the concept of branches isn't so familiar maybe it's better staying on master and wait that this is merged and just do a git pull then.

I know nothing about any of this but I figured out the instructions you've written and now it works perfectly! it took me few minutes to realize that I needed to link the directory after the cd. I spent too much time copy-pasting and double-checking everything but I remembered the cd step during installation...... eventually... Anywho, thank you!

@Rakambda Rakambda mentioned this pull request Oct 1, 2021
@Rakambda
Copy link
Contributor

Rakambda commented Oct 1, 2021

With currently the latest wout-helix-api feature branch changes: Updating 5f6c755..3c31015


$ python run.py 

30/09 23:08:21 - 🌐  Analytics running on http://0.0.0.0:5000/

30/09 23:08:21 - 💣  Start session: 'xxx'

30/09 23:08:21 - 🤓  Loading data for 4 streamers. Please wait...

30/09 23:08:27 - 😴  xxx (49.21k points) is Offline!

30/09 23:08:28 - 😴  yyy (27.52k points) is Offline!

30/09 23:08:30 - 😴  zzz (11.38k points) is Offline!

30/09 23:08:31 - 😴  www (18.99k points) is Offline!

^C30/09 23:08:36 - CTRL+C Detected! Please wait just a moment!

Traceback (most recent call last):

  File "run.py", line 75, in <module>

    twitch_miner.mine(

  File "/home/xxx/Downloads/Twitch-Channel-Points-Miner-v2/TwitchChannelPointsMiner/TwitchChannelPointsMiner.py", line 122, in mine

    self.run(streamers=streamers, blacklist=blacklist, followers=followers)

  File "/home/xxx/Downloads/Twitch-Channel-Points-Miner-v2/TwitchChannelPointsMiner/TwitchChannelPointsMiner.py", line 227, in run

    time.sleep(30)

  File "/home/xxx/Downloads/Twitch-Channel-Points-Miner-v2/TwitchChannelPointsMiner/TwitchChannelPointsMiner.py", line 307, in end

    self.ws_pool.end()

AttributeError: 'NoneType' object has no attribute 'end'

This isn't linked to this PR.
#293

@Rakambda
Copy link
Contributor

Rakambda commented Oct 1, 2021

@Tkd-Alex i think this would be great merging this somewhat soon. This seem stable enough and is a blocking issue that brings a lot of confusion in the issues recently.

@Tkd-Alex Tkd-Alex linked an issue Oct 1, 2021 that may be closed by this pull request
@Tkd-Alex Tkd-Alex marked this pull request as ready for review October 1, 2021 08:54
@Tkd-Alex Tkd-Alex merged commit 05b6bd1 into master Oct 1, 2021
@EEEmill
Copy link

EEEmill commented Oct 8, 2021

I have "re-installed" and got this now.
30/09/21 17:43:31 - INFO - [run]: 😢 Streamer --- does not exist 30/09/21 17:43:31 - INFO - [run]: 😢 Streamer --- does not exist Traceback (most recent call last): File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\run2.py", line 65, in <module> twitch_miner.mine( File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\TwitchChannelPointsMiner.py", line 122, in mine self.run(streamers=streamers, blacklist=blacklist, followers=followers) File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\TwitchChannelPointsMiner.py", line 246, in run user_id=self.twitch.twitch_login.get_user_id(), File "C:\Users\-\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\classes\TwitchLogin.py", line 214, in get_user_id return int(self.get_cookie_value("persistent").split("%")[0]) AttributeError: 'NoneType' object has no attribute 'split'

You're still using the master branch and not wout-helix-api.

Ok, I have read something about it. Can you explain more what I should do with it? Just "install" it? https://github.com/Tkd-Alex/Twitch-Channel-Points-Miner-v2/tree/wout-helix-api

git clone https://github.com/Tkd-Alex/Twitch-Channel-Points-Miner-v2
cd Twitch-Channel-Points-Miner-v2
git checkout wout-helix-api

if the concept of branches isn't so familiar maybe it's better staying on master and wait that this is merged and just do a git pull then.

I know nothing about any of this but I figured out the instructions you've written and now it works perfectly! it took me few minutes to realize that I needed to link the directory after the cd. I spent too much time copy-pasting and double-checking everything but I remembered the cd step during installation...... eventually... Anywho, thank you!

Thank you! It worked! :)

@Tkd-Alex Tkd-Alex deleted the wout-helix-api branch March 8, 2022 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Attribute error? followers not found? "X streamer does not exist" - Happens when launching run.py