Zequez / reddit-placebot

A bot that paints on Reddit /r/place. Works with multiple accounts, and can work with a remote target file for multiple people with the same objective.
MIT License
227 stars 78 forks source link

r/place comeback. #46

Open Arsyad1105 opened 2 years ago

Arsyad1105 commented 2 years ago

Hi, do you think this still works for new upcoming r/place? If yes I still don't understand on how to put pictures.

jakubfabijan commented 2 years ago

It throws error 403 in my case

AggelosM commented 2 years ago

Can we resurrect this repo? Unless there's a better one somewhere.

VNGamerGit commented 2 years ago

It throws error 403 in my case

you tried it out? and how did you get 403?

leoherzog commented 2 years ago

Happy to see I'm not the only person who immediately thought about this project again today.

Raminios commented 2 years ago

I suspect most of the BMP -> request mapping stuff could be repurposed, but the URLs etc. have been changed for this time.

This is a Powershell request sniffed out from the browser which worked. Bearer token redacted for obvious reasons.

$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$session.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36"
Invoke-WebRequest -UseBasicParsing -Uri "https://gql-realtime-2.reddit.com/query" `
-Method "POST" `
-WebSession $session `
-Headers @{
"method"="POST"
  "authority"="gql-realtime-2.reddit.com"
  "scheme"="https"
  "path"="/query"
  "sec-ch-ua"="`" Not A;Brand`";v=`"99`", `"Chromium`";v=`"99`", `"Google Chrome`";v=`"99`""
  "apollographql-client-name"="mona-lisa"
  "sec-ch-ua-mobile"="?0"
  "authorization"="Bearer [REDACTED]"
  "accept"="*/*"
  "apollographql-client-version"="0.0.1"
  "sec-ch-ua-platform"="`"Windows`""
  "origin"="https://hot-potato.reddit.com"
  "sec-fetch-site"="same-site"
  "sec-fetch-mode"="cors"
  "sec-fetch-dest"="empty"
  "referer"="https://hot-potato.reddit.com/"
  "accept-encoding"="gzip, deflate, br"
  "accept-language"="en-GB,en-US;q=0.9,en;q=0.8"
} `
-ContentType "application/json" `
-Body "{`"operationName`":`"setPixel`",`"variables`":{`"input`":{`"actionName`":`"r/replace:set_pixel`",`"PixelMessageData`":{`"coordinate`":{`"x`":170,`"y`":33},`"colorIndex`":31,`"canvasIndex`":0}}},`"query`":`"mutation setPixel(`$input: ActInput!) {\n  act(input: `$input) {\n    data {\n      ... on BasicMessage {\n        id\n        data {\n          ... on GetUserCooldownResponseMessageData {\n            nextAvailablePixelTimestamp\n            __typename\n          }\n          ... on SetPixelResponseMessageData {\n            timestamp\n            __typename\n          }\n          __typename\n        }\n        __typename\n      }\n      __typename\n    }\n    __typename\n  }\n}\n`"}"
MarsVard commented 2 years ago

config has changed as well, https://www.reddit.com/api/place/board-bitmap <= this doesn't point to the board anymore

guffelman commented 2 years ago

Looks like https://hot-potato.reddit.com/embed/ might be the new place board. Not sure how we can get the bitmap from there yet. I've been looking at the authentication.js file to see if I can modify it for the new Auth Model.

AstroOrbis commented 2 years ago

Is there a working fork or are we all patching the current repo?

werdes commented 2 years ago

full bitmap is still loaded, but url seems to have some logic behind it. https://hot-potato.reddit.com/media/canvas-images/1648827785838-0-f-8Fg292Lw.png

first part seems to be a unix timestamp, second part (f = full, d = diff), f is always the full one, d has diff pixels

no idea for second part (0) or 4th part

AstroOrbis commented 2 years ago

Error it throws for me:

> reddit-placebot@1.1.0 start
> node src/run.js --harmony

node:internal/modules/cjs/loader:1174
    throw err;
    ^

SyntaxError: \reddit-placebot-master\users.json: Unexpected token } in JSON at position 45
    at parse (<anonymous>)
    at Object.Module._extensions..json (node:internal/modules/cjs/loader:1171:22)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\User\Desktop\reddit-placebot-master\src\run.js:12:15)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47

node 16.14.2 LTS

Error it throws for me:

> reddit-placebot@1.1.0 start
> node src/run.js --harmony

node:internal/modules/cjs/loader:1174
    throw err;
    ^

SyntaxError: \reddit-placebot-master\users.json: Unexpected token } in JSON at position 45
    at parse (<anonymous>)
    at Object.Module._extensions..json (node:internal/modules/cjs/loader:1171:22)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\User\Desktop\reddit-placebot-master\src\run.js:12:15)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47

node 16.14.2 LTS

That's a parse error in your users.json

DeltaNeverUsed commented 2 years ago

you probably have a , on the second last line of your users.json

NamesMark commented 2 years ago

you probably have a , on the second last line of your users.json

Yeah, my bad. Now 403 for me also

Getting modhash and cookies for  ...
Unhandled rejection Error: Request failed with status code 403
    at createError (C:\Users\User\Desktop\reddit-placebot-master\node_modules\axios\lib\core\createError.js:15:15)
    at settle (C:\Users\User\Desktop\reddit-placebot-master\node_modules\axios\lib\core\settle.js:18:12)
    at IncomingMessage.handleStreamEnd (C:\Users\User\Desktop\reddit-placebot-master\node_modules\axios\lib\adapters\http.js:186:11)
    at IncomingMessage.emit (node:events:538:35)
    at endReadableNT (node:internal/streams/readable:1345:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
AstroOrbis commented 2 years ago

I feel like we should bring this to discord, friend me AstroOrbis#9797 and I'll create a group chat, something about GitHub issues is weird in short term conversations

CicadaCinema commented 2 years ago

I'm starting over from scratch at this repo, small PRs appreciated (which would move us closer to the end goal).

https://github.com/CicadaCinema/place-bot

Current state: places a single pixel at the specified coordinates

VNGamerGit commented 2 years ago

all of this aside, anyone interested in an alliance?

firefoxnightlymozzila commented 2 years ago

soooo has anyone made a working fork

AstroOrbis commented 2 years ago

soooo has anyone made a working fork

We're working on it

foxrumor commented 2 years ago

Can't wait!

CicadaCinema commented 2 years ago

I prefer working in the open - see https://github.com/CicadaCinema/place-bot/issues/1 for the current state of the attempt written in golang.

OverDriveGain commented 2 years ago

This repo uses old API of reddit. I think porting the same tool to the new API wouldn't be hard

gavjan commented 2 years ago

full bitmap is still loaded, but url seems to have some logic behind it. https://hot-potato.reddit.com/media/canvas-images/1648827785838-0-f-8Fg292Lw.png

@werdes where do you get this URL from?

NotAProton commented 2 years ago

@gavjan check the network tab in dev tools image

ImNotOnline commented 2 years ago

So how is this coming?

LiamTheNinja5 commented 2 years ago

So how is this coming?

give people some time coding is hard

michaelshumshum commented 2 years ago

https://github.com/michaelshumshum/r-placer

here is my attempt. anybody who wants to help and knows python will be appreciated.

current state: logging in successful, account creation successful, adding pixels FAIL.

rhozetta commented 2 years ago

https://github.com/michaelshumshum/r-placer

here is my attempt. anybody who wants to help and knows python will be appreciated.

current state: logging in successful, account creation successful, adding pixels FAIL.

if you need help with things like request links i can probably help

LiamTheNinja5 commented 2 years ago

I don't know a lot about of coding but if I can help in anyway just let me know

danr2c2 commented 2 years ago

Are these the right urls for adding pixels?

image image
michaelshumshum commented 2 years ago

Are these the right urls for adding pixels?

image image

i know for certain the first one is. when you change a pixel, that url is the one that is posted to. it includes some payload data that corresponds to coordinates and color. though, i am not sure what that second one is.

rsedxcftvgyhbujnkiqwe commented 2 years ago

https://github.com/rdeepak2002/reddit-place-script-2022 This repo works successfully, using both the pull request from carlescufi plus a fix to the useragent.

The parameter headers={'User-agent': 'placebot001'} should be added to the requests.post line. I would add this info onto that page but I would like to bring attention to it here.

This bot is simplistic, however. It only iterates through the image and does not go back to fix pixels, and it overrides existing pixels, because it does not get any image data from the API. Is there any API call that will return the existing r/place image, so that it can be manipulated in code?

Blazzycrafter commented 2 years ago

i used burb to get a new api path.... the site api/login dont exist... they used /login with out api... and an anodet system oauth...

MarsVard commented 2 years ago

https://gfycat.com/desertedeverlastinghogget

foco21 commented 2 years ago

someone should try forking this ?

EntropyValley commented 2 years ago

If anyone here wants to help improve the bot linked above (https://github.com/rdeepak2002/reddit-place-script-2022), there's a fork of that bot that includes pixel checking that just needs to be reimplemented on an updated fork (the fork dev says he doesn't want to PR and it's based on a much older version of the repo). We could really use a good python dev to look over the fork (https://github.com/DeltaNeverUsed/reddit-place-script-2022-get-board), then reimplement pixel checking from that fork into a new fork of the main repo (https://github.com/rdeepak2002/reddit-place-script-2022) and then PR it back in. I'm planning on working on it tomorrow if it's not already done, but that's a long ways away in the world of r/place.

edit: chrome did a weird and didn't update the url when I opened the fork. I updated the fork url with an actual url to the fork we need to implement back into the main repo

dsf3449 commented 2 years ago

@rsedxcftvgyhbujnkiqwe I've created an endpoint. Send a GET request to https://canvas.codes/canvas.

The expected response is:

{
    "ok": true,
    "url": "https://hot-potato.reddit.com/media/canvas-images/1648872350237-0-f-ryt2oirH.png"
}

Note: there is an optional ts field which may be returned if you are receiving a cached URL.

This URL is a raw 1000x1000 pixel image generated by Reddit's api within the past 10 seconds.

MarsVard commented 2 years ago

@dsf3449

I'm getting Internal server error

dsf3449 commented 2 years ago

@MarsVard Oops, sorry, oversight on my end. Should be good now!

Glass47 commented 2 years ago

Can someone make GUI version of this for noobs? I will pay 10$ i just want to have fun!

vesk4000 commented 2 years ago

If someone can make the APIs work, I can probably make a pretty good GUI in something like Godot quite quickly. Does anyone want to collaborate? Is there a Discord or something like that, where we can work?

Glass47 commented 2 years ago

Hey @vesk4000 check this. Let me know if this can work for you to make GUI. No need to be fancy shit just option to load specific image what bots should draw and repair if i select that option. Also i want support for adding multiple accounts easy and perhaps proxies so they don't get banned if they do IP detection. Or if they are not IP detected/shadowbanned then just compile without proxy support. But support for mutliple accounts. :)

EntropyValley commented 2 years ago

Honestly idk if it's such a good idea to build a GUI. While I'd ideally love for things to be as accessible as possible, we are working against an organization who has said that they don't want bots to exist, and so the easier access is, the more likely it's going to balloon to a point where they change the api and break things and/or start banning bot users more frequently. Imo, the way the linked bot repo works is pretty simple for people with even a bit of CLI or python experience, and so it's available to anyone willing to put in the effort to figure things out without being so available that it balloons out of control to a point where Reddit takes more action against us. If others feel differently, then go ahead, but this is just my worry haha

Glass47 commented 2 years ago

Honestly idk if it's such a good idea to build a GUI. While I'd ideally love for things to be as accessible as possible, we are working against an organization who has said that they don't want bots to exist, and so the easier access is, the more likely it's going to balloon to a point where they change the api and break things and/or start banning bot users more frequently. Imo, the way the linked bot repo works is pretty simple for people with even a bit of CLI or python experience, and so it's available to anyone willing to put in the effort to figure things out without being so available that it balloons out of control to a point where Reddit takes more action against us. If others feel differently, then go ahead, but this is just my worry haha

Understand your statement and i respect. Gonna spend some time setting this up so i can have fun..

NoamikoT commented 2 years ago

Sorry if this is not the place but is there a working product? really want to save my flag.

MarsVard commented 2 years ago

@dsf3449 can you make your endpoint redirect to the bitmap instead? Or with a flag?

gnhnjac commented 2 years ago

Actually I've made a version that works! it fetches the background successfully using pypeteer and it successfully places pixels. https://github.com/gnhnjac/rplace-bot Happy for pull requests as there are still issues and it only works for 1 account currently.

dsf3449 commented 2 years ago

Update to my endpoint (https://canvas.codes/canvas)

It will now return the following object:

{
    "ok": true,
    "url": "https://hot-potato.reddit.com/media/canvas-images/1648938881174-0-f-xonqAt69.png",
    "canvas_left": "https://hot-potato.reddit.com/media/canvas-images/1648938881174-0-f-xonqAt69.png",
    "canvas_right": "https://hot-potato.reddit.com/media/canvas-images/1648938881153-1-f-TXag23ti.png"
}

Where canvas_left refers to the left side of the board and canvas_right is the new section added today.

url is still included for backwards compatibility, but it's value is the same as canvas_left.

Olmo-Gutierrez commented 2 years ago

If someone can make the APIs work, I can probably make a pretty good GUI in something like Godot quite quickly. Does anyone want to collaborate? Is there a Discord or something like that, where we can work?

What's ur discord?

Truedill1 commented 2 years ago

how do we do this boss

gnhnjac commented 2 years ago

can someone look at my code / does someone wanna collaborate? It successfully placed pixels and fetched the map for me so that’s big progress.

smirea commented 2 years ago

Howdy! throwing my hat (bot) into the ring if y'all are interested: https://github.com/smirea/reddit-place-bot

It's all written in typescript and supports:

Feel free to use / submit PRs