Tkd-Alex / Twitch-Channel-Points-Miner-v2

A simple script that will watch a stream for you and earn the channel points.
GNU General Public License v3.0
1.22k stars 679 forks source link

more than one account #69

Closed Lim0H closed 3 years ago

Lim0H commented 3 years ago

threads do not allow more than one account, but the process allows, through the multiprocessing module, the Process function, thus the websocket module can use more than one account, but each process takes exactly the same amount of memory as one process, which now may need to be changed itself websocket module, if there are analogues (not searched)

Tkd-Alex commented 3 years ago

I don't understand what's your problem and what you want. If you need to run more than one accounts create a multiple run.py, one for each account

Lim0H commented 3 years ago

I do this, but I want everything in one file and that there is little memory, but it takes so much

Tkd-Alex commented 3 years ago

I don't think I will work on this.

Lim0H commented 3 years ago

thanks for answers. But for each process 500-700MB is a lot somehow, I'm just asking if you know how to solve it, because it is long and useful to parse all the code yourself

Tkd-Alex commented 3 years ago

how many streamers are you tracking?

Lim0H commented 3 years ago

3 accounts (I have a base), every 2 streamers that a twitch gives

Lim0H commented 3 years ago

twitch does not give more than 3 accounts from one ip

Tkd-Alex commented 3 years ago

I mean twitch_miner.mine([ inside-this-array ])

Lim0H commented 3 years ago

I want to speed up the process of getting points, legally, but I know about a bug that can be used like a moderator and above

Tkd-Alex commented 3 years ago

I don't know how to help you and what are you trying to do or I just can't understand what you say

Lim0H commented 3 years ago

I'm trying to get more points

Tkd-Alex commented 3 years ago

... and I don't think you can :laughing: If are you able to explain how to do that maybe I can find a good solution with the lowest memory usage

Lim0H commented 3 years ago

I am using the first version, because I do not need a betting system, most likely I will have to change the socket module, I will try

Tkd-Alex commented 3 years ago

as you wish 😂 On this version you can disable the bet if you don't need

Moreover I have checked my memory usage and it's <60Mb 🤔

Lim0H commented 3 years ago

I didn’t see how much RAM it uses, I saw how much it uses paging files, I only have 4GB, and paging files are about 15GB

testdev123456 commented 3 years ago

I'm mining 110 streamers and it's using 40mb in RAM. page file would only get 40mb 'bigger' if you have low ram anyways.. (as far as I know.. ) a new instance/user would take another 40mb..

Lim0H commented 3 years ago

will have to try🐭

Tkd-Alex commented 3 years ago

@Lim0H news ?

Lim0H commented 3 years ago

no

Lim0H commented 3 years ago

I wanted through another module, but the only one that was ready for async did not work at all. You need to write your own module or redo that websocket

Tkd-Alex commented 3 years ago

So we can close this issue or not?

egorcreep commented 3 years ago

it would be nice if you would add multi-account support that I can farm from several accounts at the same time, it is uncomfortable to fill every run.py script for each account, you can add something like that: username="your-twitch-username", password="write-your-secure-psw",
username1="your-twitch-username", password1="write-your-secure-psw",
username2="your-twitch-username", password2="write-your-secure-psw",

or separate .txt file with accounts like: username:password username1:password1 username2:password2

Rakambda commented 3 years ago

it would be nice if you would add multi-account support that I can farm from several accounts at the same time, it is uncomfortable to fill every run.py script for each account, you can add something like that:

username="your-twitch-username",

password="write-your-secure-psw",   

username1="your-twitch-username",

password1="write-your-secure-psw",   

username2="your-twitch-username",

password2="write-your-secure-psw",   

or separate .txt file with accounts like:

username:password

username1:password1

username2:password2

You could simply pass user/password as arguments to your run.py and run it x times with the x accounts...

egorcreep commented 3 years ago

You could simply pass user/password as arguments to your run.py and run it x times with the x accounts...

It is hard if you are using it with many accounts also with the latest version I can't open more than 28 accounts (this problem cause only on my side, my friend doesn't have it, actually no idea why it happens), there is like memory leak because I am getting "out of memory" errors and got bluescreen once, had to downgrade to the old version I am fine with it and not getting any errors, currently using multi-run with PyCharm, it would be nice and cool if you can operate with it in one window

Rakambda commented 3 years ago

Well I do agree that having lots of accounts wouldn't be simple to handle well on your side either.

But I also agree with Tkd when he says he doesn't wanna do this. To me it sounds out of scope of this script to handle several accounts. The conf is already complex enough as it is, managing connections too so it'd add a lot of maintenance to add a functionality that can be overcome on your side. Most people would have 1 account, maybe 2 but not a ton.


Personally I think that it is something you have to do yourself if you want scale up to that high level of farming (just my opinion tho). Having 28 accounts isn't without any consequences and if you need to handle that much, you probably need to take better solutions than relying on pycharm for it. It's not just a simple script for your own account that you'd run for yourself at this point.

Though it'd require more investment from you and explore solutions that you're maybe not aware of if you just use pycharm. But automating the start of your different runners with a script shouldn't be too hard. And then you can find other tools to aggregate the different log files of the different miners. I won't lie, having a linux env to run your miners probably would have made things easier.

Anyway just as an example you can try something like that (powershell) to start your miners (assuming you give user/password to your main.py). You'd just have to define your list of accounts into the $accounts array, and then you'll see all the logs in the same window. Pressing CTRL+C will kill all the python processes.

$accounts = [pscustomobject]@{
account1 = 'password1'
account2 = 'password2'
}

$processes = @()

$accounts.PSObject.Properties | ForEach-Object {
    $startedProcess = Start-Process python -ArgumentList "run.py $($_.Name) $($_.Value)" -PassThru -NoNewWindow
    $processes += $startedProcess
}

try
{
    # Maybe there's a better way to wait for the CTRL+C, idk
    [console]::TreatControlCAsInput = $true
    while ($true) {
        Start-Sleep -s 5
        if ([console]::KeyAvailable) {
            $key = [system.console]::readkey($true)
            if (($key.modifiers -band [consolemodifiers]"control") -and
                ($key.key -eq "C"))
            {
                Write-Host "Terminating..."
                foreach ($process in $processes) {
                    Write-Host "Killing $($process.Id)"
                    try
                    {
                        Stop-Process -InputObject $process
                    } finally {}
                }
                break
            }
        }
    }
}
finally
{
    [console]::TreatControlCAsInput = $false
}

One concern though for the automation for scripting the start of the miner is the logs. Currently if you would pass the user/password to your main.py and start the miner with them, then all your logs will end up in the same file. I don't know if it'd be a problem or if the logging library will handle that just fine. Maybe the path could be configurable at some point. But I guess that if you already run up to 28 miners in the same working directory then it seems to handle it fine.

egorcreep commented 3 years ago

Thank you, it works well. I appreciate that. For some reason, but it still limits me to less than 25 running scripts at one time, PowerShell can randomly run only 7/19/24/25 with this script, no idea why, but thank you anyway, this is suitable for those who have not many accounts. Too many problems with it. EDIT: Seems like the script starting the same account several times, I put different accounts, and logs show me the same statistic: image

I will keep using this: image

Rakambda commented 3 years ago

well the script runs the same main.py. if you have different folders for each user you'll need to tweak the start-process line and give the correct path to the script depending on the user.

Lim0H commented 3 years ago

I use this to start processes

https://pastebin.com/14XcvPWY

egorcreep commented 3 years ago

I use this to start processes

https://pastebin.com/14XcvPWY

can you show an example of how to fill the script properly?

Lim0H commented 3 years ago

https://dropmefiles.com/iVv9b

Lim0H commented 3 years ago

I think I need to do it in

import websocket

websocket.enableTrace(True) ws = websocket.WebSocket() ws.connect("ws://echo.websocket.org") ws.ping() ws.pong() ws.close()

Lim0H commented 3 years ago

it seems like I managed to do this, now I'm testing, but so far the data is correct

[13p2b]: liltsoy is offline currently. [13p2b]: hfman is offline currently. [13p2b]: soawesomesonic is live! [13p2b]: 67290 channel points for liltsoy! [13p2b]: 660 channel points for hfman! [13p2b]: 0 channel points for soawesomesonic! [13p2b]: {'type': 'PONG'} [13p2b]: {'type': 'RESPONSE', 'error': '', 'nonce': 'TK3NplAvTRMPSWbsI6VdBAAb6SzkBA'} [antimirrobot]: 344540 channel points for liltsoy! [13p2b]: {'type': 'RESPONSE', 'error': '', 'nonce': 'lMtKmZLyl1Cv9b5pNhzNp15ONfC9JP'} [13p2b]: {'type': 'RESPONSE', 'error': '', 'nonce': 'JBRjQh3P5atlZpCskP4dHpzgNzHOU9'} [13p2b]: {'type': 'RESPONSE', 'error': '', 'nonce': 'GIkOIVPHU3ETAT4bwugLFZMCA7aiwa'} [13p2b]: {'type': 'RESPONSE', 'error': '', 'nonce': '3lZVKRDedtjZdsxiCThgmcb8AnvH3R'} [13p2b]: {'type': 'RESPONSE', 'error': '', 'nonce': 'Yk2vfvgg9ZzMD4dXEZcWm0CUiQzH1t'} [13p2b]: {'type': 'RESPONSE', 'error': '', 'nonce': 'AAR9CScmuKfnqR3zRxQ0WDH9dgHxTQ'} [13p2b]: {'type': 'PONG'} [antimirrobot]: 640 channel points for hfman! [antimirrobot]: 0 channel points for soawesomesonic! [antimirrobot]: {'type': 'PONG'} [antimirrobot]: {'type': 'RESPONSE', 'error': '', 'nonce': 'SvUmnSfyl1PeIq4wvnmfheRzvNWqVh'} [antimirrobot]: {'type': 'RESPONSE', 'error': '', 'nonce': 'g1u0ecoXx8Xhh8w14mpSDtNHjScAsJ'} [antimirrobot]: {'type': 'RESPONSE', 'error': '', 'nonce': 'LNKqPr8wJZMX5yVvL3BR4Ia9mHFxxo'} [antimirrobot]: {'type': 'RESPONSE', 'error': '', 'nonce': 'KGKtZ5J7jmjtt9Vf0qaTn36Rw5dHvL'} [antimirrobot]: {'type': 'RESPONSE', 'error': '', 'nonce': '0Z1LzekhsvQh5kxzHGMNSlqiQnAQ8H'} [antimirrobot]: {'type': 'RESPONSE', 'error': '', 'nonce': 'wpEYaLdaGYAPCxjvAevpXylSY18xBf'} [antimirrobot]: {'type': 'RESPONSE', 'error': '', 'nonce': 'aFrzUaLTvbDkOTp2qoHLeYZrkzvZ4t'} [antimirrobot]: {'type': 'PONG'} [ji3moh]: 343705 channel points for liltsoy! [ji3moh]: 1580 channel points for hfman! [ji3moh]: 520 channel points for soawesomesonic! [ji3moh]: {'type': 'PONG'} [ji3moh]: {'type': 'RESPONSE', 'error': '', 'nonce': 'oTHS2wsvHhEoDIUCBPUGcv8tqDpNkR'} [ji3moh]: {'type': 'RESPONSE', 'error': '', 'nonce': '5dFx1gVKL34pR0bHH1hHS7XTCyO2ma'} [ji3moh]: {'type': 'RESPONSE', 'error': '', 'nonce': 'Y0HKkmvYTJ7F4Ez4AtUWFQdcLDUcmB'} [ji3moh]: {'type': 'RESPONSE', 'error': '', 'nonce': 'ia9O2cQRVlt9NfU6mdJAooSSX3FNK3'} [ji3moh]: {'type': 'RESPONSE', 'error': '', 'nonce': 'h2bRYfjcIdy97JwkVJG3iQZKZPMblw'} [ji3moh]: {'type': 'RESPONSE', 'error': '', 'nonce': 'q0GmNPIDeVbgolBTXHGXftarbHliYK'} [ji3moh]: {'type': 'RESPONSE', 'error': '', 'nonce': 'kvWc87FDjAMyEkmn48Kd7qvcdZJoLl'} [ji3moh]: {'type': 'PONG'} [antimirrobot]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615320840.659452,"viewers":8}'}} [13p2b]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615320840.659452,"viewers":8}'}} [ji3moh]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615320840.659452,"viewers":8}'}} [13p2b]: {'type': 'PONG'} [antimirrobot]: {'type': 'PONG'} [ji3moh]: {'type': 'PONG'} [ji3moh]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615320871.443542,"viewers":9}'}} [antimirrobot]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615320871.443542,"viewers":9}'}} [13p2b]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615320871.443542,"viewers":9}'}} [13p2b]: {'type': 'PONG'}

Lim0H commented 3 years ago

[antimirrobot]: {'type': 'PONG'} [ji3moh]: {'type': 'PONG'} [antimirrobot]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615320931.226381,"viewers":9}'}} [13p2b]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615320931.226381,"viewers":9}'}} [ji3moh]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615320931.226381,"viewers":9}'}} [13p2b]: {'type': 'PONG'} [antimirrobot]: {'type': 'PONG'} [13p2b]: {'type': 'MESSAGE', 'data': {'topic': 'community-points-user-v1.163172994', 'message': '{"type":"points-earned","data":{"timestamp":"2021-03-09T20:15:47.235463093Z","channel_id":"217654556","point_gain":{"user_id":"163172994","channel_id":"217654556","total_points":10,"baseline_points":10,"reason_code":"WATCH","multipliers":[]},"balance":{"user_id":"163172994","channel_id":"217654556","balance":10}}}'}} [13p2b]: 10 channel points for soawesomesonic! Reason: watch. [ji3moh]: {'type': 'PONG'}

Lim0H commented 3 years ago

working!!!!!!

Lim0H commented 3 years ago

image

Lim0H commented 3 years ago

[13p2b]: {'type': 'PONG'} [antimirrobot]: {'type': 'PONG'} [13p2b]: {'type': 'MESSAGE', 'data': {'topic': 'community-points-user-v1.163172994', 'message': '{"type":"points-earned","data":{"timestamp":"2021-03-09T20:20:46.189282852Z","channel_id":"217654556","point_gain":{"user_id":"163172994","channel_id":"217654556","total_points":10,"baseline_points":10,"reason_code":"WATCH","multipliers":[]},"balance":{"user_id":"163172994","channel_id":"217654556","balance":20}}}'}} [13p2b]: 20 channel points for soawesomesonic! Reason: watch. [ji3moh]: {'type': 'PONG'} [13p2b]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615321260.471426,"viewers":7}'}} [antimirrobot]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615321260.471426,"viewers":7}'}} [ji3moh]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615321260.471426,"viewers":7}'}}

Lim0H commented 3 years ago

received only one account for the whole time

Lim0H commented 3 years ago

but the rest are working

Lim0H commented 3 years ago

"server_time":1615321530.540046,"viewers":6}'}} [13p2b]: {'type': 'PONG'} [antimirrobot]: {'type': 'PONG'} [13p2b]: {'type': 'MESSAGE', 'data': {'topic': 'community-points-user-v1.163172994', 'message': '{"type":"points-earned","data":{"timestamp":"2021-03-09T20:25:47.396057575Z","channel_id":"217654556","point_gain":{"user_id":"163172994","channel_id":"217654556","total_points":10,"baseline_points":10,"reason_code":"WATCH","multipliers":[]},"balance":{"user_id":"163172994","channel_id":"217654556","balance":30}}}'}} [13p2b]: 30 channel points for soawesomesonic! Reason: watch. [13p2b]: {'type': 'MESSAGE', 'data': {'topic': 'community-points-user-v1.163172994', 'message': '{"type":"claim-available","data":{"timestamp":"2021-03-09T20:25:47.40812552Z","claim":{"id":"d7a46c74-254d-472c-b09d-c601c7122292","user_id":"163172994","channel_id":"217654556","point_gain":{"user_id":"163172994","channel_id":"217654556","total_points":50,"baseline_points":50,"reason_code":"CLAIM","multipliers":[]},"created_at":"2021-03-09T20:25:42Z"}}}'}} [13p2b]: Claiming the bonus for soawesomesonic! [13p2b]: {'type': 'MESSAGE', 'data': {'topic': 'community-points-user-v1.163172994', 'message': '{"type":"points-earned","data":{"timestamp":"2021-03-09T20:25:47.896672391Z","channel_id":"217654556","point_gain":{"user_id":"163172994","channel_id":"217654556","total_points":50,"baseline_points":50,"reason_code":"CLAIM","multipliers":[]},"balance":{"user_id":"163172994","channel_id":"217654556","balance":80}}}'}} [13p2b]: 80 channel points for soawesomesonic! Reason: bonus claimed. [13p2b]: {'type': 'MESSAGE', 'data': {'topic': 'community-points-user-v1.163172994', 'message': '{"type":"claim-claimed","data":{"timestamp":"2021-03-09T20:25:47.902579811Z","claim":{"id":"d7a46c74-254d-472c-b09d-c601c7122292","user_id":"163172994","channel_id":"217654556","point_gain":{"user_id":"163172994","channel_id":"217654556","total_points":50,"baseline_points":50,"reason_code":"CLAIM","multipliers":[]},"created_at":"2021-03-09T20:25:42Z"}}}'}} [ji3moh]: {'type': 'PONG'} [antimirrobot]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615321560.610269,"viewers":6}'}} [13p2b]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615321560.610269,"viewers":6}'}} [ji3moh]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615321560.610269,"viewers":6}'}}

Lim0H commented 3 years ago

[13p2b]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615321830.809467,"viewers":5}'}} [13p2b]: {'type': 'PONG'} [antimirrobot]: {'type': 'PONG'} [13p2b]: {'type': 'MESSAGE', 'data': {'topic': 'community-points-user-v1.163172994', 'message': '{"type":"points-earned","data":{"timestamp":"2021-03-09T20:30:46.160276224Z","channel_id":"217654556","point_gain":{"user_id":"163172994","channel_id":"217654556","total_points":10,"baseline_points":10,"reason_code":"WATCH","multipliers":[]},"balance":{"user_id":"163172994","channel_id":"217654556","balance":90}}}'}} [13p2b]: 90 channel points for soawesomesonic! Reason: watch. [ji3moh]: {'type': 'PONG'} [ji3moh]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615321860.820962,"viewers":3}'}} [antimirrobot]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615321860.820962,"viewers":3}'}} [13p2b]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615321860.820962,"viewers":3}'}} [13p2b]: {'type': 'PONG'} [antimirrobot]: {'type': 'PONG'} [ji3moh]: {'type': 'PONG'} [antimirrobot]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615321890.295008,"viewers":3}'}} [ji3moh]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615321890.295008,"viewers":3}'}} [13p2b]: {'type': 'MESSAGE', 'data': {'topic': 'video-playback-by-id.217654556', 'message': '{"type":"viewcount","server_time":1615321890.295008,"viewers":3}'}}

Lim0H commented 3 years ago

now then I'll try to use a proxy

egorcreep commented 3 years ago

now then I'll try to use a proxy

Lim0H, can you send me ur contact details (telegram, whatever)

Lim0H commented 3 years ago

this is telegram JI3MOH

Tkd-Alex commented 3 years ago

I use this to start processes

https://pastebin.com/14XcvPWY

Why not spawn a Python process instead of Windows/Unix process?

With this script I don't think you will reduce the memory usage 🙄

Lim0H commented 3 years ago

I managed to make a system on streams, I did it for the first version, because I started with it right away, but I think it can also be done in the second. Here's what I changed

self.free_websocket = websocket.WebSocketApp("wss://pubsub-edge.twitch.tv/v1",
            on_message=on_message, on_open=WebsocketsPool.on_open, on_close=WebsocketsPool.handle_websocket_reconnection)
        self.free_websocket.parent_pool = self
        self.free_websocket.is_closed = False
        self.free_websocket.is_opened = False
        self.free_websocket.topics = []
        self.free_websocket.pending_topics = []
        wst = threading.Thread(name=get_nameTH(),target=self.free_websocket.run_forever)
        wst.start()
Lim0H commented 3 years ago

to work it was necessary to solve the problem of desynchronization, I did it so that I wrote a nickname in the name of the stream and so each thread knows which nickname it receives