Code Monkey home page Code Monkey logo

headless-ukplace's Introduction

Headless UK

A headless placeUK client written in python 3.10.

Credit to Headless-Henk and PlaceNL

Simple Install

  1. Install Python 3.10 - https://www.python.org/downloads (direct download)
  2. Download a zip of the script - https://github.com/G3VV/headless-uk/archive/refs/heads/main.zip
  3. Unzip it inside a folder
  4. Run pip install -r requirements.txt, this installs all the required stuff. (might need to do pip install -r requirements.txt --user or python pip install -r requirements.txt)
  5. Run python index.py (might need to do python3 index.py)
  6. A file should be automatically created called config.toml, configure the settings inside it (see below)
  7. Once config.toml is configured run python index.py again.
  8. and you should be finished and the script should be running on your account!

If you encounter any issues join our Discord and ask for help in #script-support

Configuration

You can configure headless-uk with using a config toml file or using env vars.

You can place 1 account in this configuration. If you want to use multiple accounts in the same process you have to use an accounts.toml.

  • You can configure the name of the accounts.toml with the --accounts flag.
  • You can configure the name of the config.toml with the --config flag.

Accounts Toml File

The accounts.toml file is very simple. It is just username="password" on every line. Like this:

username1 = "password1"
username2 = "password2"
username3 = "password3"

If you have weird characters in your username then this is also a valid accounts.toml:

"us.er.name1" = "password1"
"us er name2" = "password2"
username3 = "password3"

You can configure the name of the accounts.toml with the --accounts flag.

Toml Config File

You can set the options in a toml configuration file. By default, this file is config.toml in the same directory as the program. You can also change where this file is located using the --config flag.

If you start the program without a config file present a basic config file will be created for you.

This is what the default file looks like:

reddit_username = 'YOUHAVETOADDTHIS'
reddit_password = 'YOUHAVETOADDTHIS'
chief_host = "placeuk.g3v.co.uk"
reddit_uri_https = 'https://gql-realtime-2.reddit.com/query'
reddit_uri_wss = 'wss://gql-realtime-2.reddit.com/query'
canvas_indexes = ["0", "1", "2", "3", "4", "5"]  # Canvas indexes to download, Toml has no null we use 'None' 
stats = false   # Wether to subscribe to stats updates from chief
pingpong = false   # Whether the client should show ping and pong messages.

Using an auth token instead of username

Instead of having reddit_username and reddit_password you can also have:

auth_token = "INSERT TOKEN HERE"

But if you do not have reddit_username and reddit_password then the token will not refresh, and you have to replace it every 24 hours.

See the How to get a reddit jwt token section for information on how to get a reddit jwt token.

Note that in the toml file the canvas_indexes are all strings. In the env var this different and it is a json array of numbers and null.

How to get reddit jwt?

The easiest way is to just run login.py to get a token. This will also automatically add the token to the config.toml. You can also run login.py by doing poetry run login. These also support the --config flag.

You can also go to the website:

  1. Go to r/place
  2. Open dev tools by pressing ctrl+shift+i
  3. Click on the network tab
  4. Locate the pause button but do not press it, it looks like a stop button on chrome.
  5. Now in the list of request find a post request to https://gql-realtime-2.reddit.com/query
  6. Press the pause button to stop new request from coming in
  7. Click on the post request in the list
  8. Click on headers
  9. Find the Authorization header
  10. Copy the value of the authorization header. It should start with Bearer and then a bunch of letters seperated.

Realize that these tokens are valid for about 1440 minutes. There is no auto token refresh functionality yet. This is also because I don't know how reddit refreshes their tokens. Let me know if you koow.

Be sure to not share this jwt with others!




Disclaimer

headless-ukplace's People

Contributors

tintin10q avatar g3vv avatar rubennl avatar wenest avatar nilsbebelaar avatar ebosveld avatar mechoriet avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.