reddit-placebot icon indicating copy to clipboard operation
reddit-placebot copied to clipboard

r/place comeback.

Open Arsyad1105 opened this issue 2 years ago • 58 comments

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

Arsyad1105 avatar Apr 01 '22 09:04 Arsyad1105

It throws error 403 in my case

Szafranek13 avatar Apr 01 '22 12:04 Szafranek13

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

AggelosM avatar Apr 01 '22 13:04 AggelosM

It throws error 403 in my case

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

VNGamerGit avatar Apr 01 '22 14:04 VNGamerGit

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

leoherzog avatar Apr 01 '22 14:04 leoherzog

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`"}"

Raminios avatar Apr 01 '22 15:04 Raminios

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

MarsVard avatar Apr 01 '22 15:04 MarsVard

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.

guffelman avatar Apr 01 '22 15:04 guffelman

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

AstroOrbis avatar Apr 01 '22 15:04 AstroOrbis

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

werdes avatar Apr 01 '22 15:04 werdes

Error it throws for me:

> [email protected] 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:

> [email protected] 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

AstroOrbis avatar Apr 01 '22 15:04 AstroOrbis

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

DeltaNeverUsed avatar Apr 01 '22 15:04 DeltaNeverUsed

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)

NamesMark avatar Apr 01 '22 15:04 NamesMark

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

AstroOrbis avatar Apr 01 '22 15:04 AstroOrbis

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

CicadaCinema avatar Apr 01 '22 16:04 CicadaCinema

all of this aside, anyone interested in an alliance?

VNGamerGit avatar Apr 01 '22 16:04 VNGamerGit

soooo has anyone made a working fork

firefoxnightlymozzila avatar Apr 01 '22 16:04 firefoxnightlymozzila

soooo has anyone made a working fork

We're working on it

AstroOrbis avatar Apr 01 '22 16:04 AstroOrbis

Can't wait!

foxrumor avatar Apr 01 '22 17:04 foxrumor

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.

CicadaCinema avatar Apr 01 '22 17:04 CicadaCinema

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

OverDriveGain avatar Apr 01 '22 17:04 OverDriveGain

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?

gavjan avatar Apr 01 '22 18:04 gavjan

@gavjan check the network tab in dev tools image

NotAProton avatar Apr 01 '22 18:04 NotAProton

So how is this coming?

ImNotOnline avatar Apr 01 '22 19:04 ImNotOnline

So how is this coming?

give people some time coding is hard

LiamTheNinja5 avatar Apr 01 '22 19:04 LiamTheNinja5

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.

michaelshumshum avatar Apr 01 '22 20:04 michaelshumshum

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

rhozetta avatar Apr 01 '22 20:04 rhozetta

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

LiamTheNinja5 avatar Apr 01 '22 21:04 LiamTheNinja5

Are these the right urls for adding pixels?

image image

danr2c2 avatar Apr 01 '22 21:04 danr2c2

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.

michaelshumshum avatar Apr 01 '22 21:04 michaelshumshum

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?

rsedxcftvgyhbujnkiqwe avatar Apr 01 '22 21:04 rsedxcftvgyhbujnkiqwe