A set of Python scripts to help you play the Bilibili Sketching Board.
- Written in asynchronous structure with asyncio and aiohttp, can support a large number of accounts
- Use cURL format command-line to extract user cookies
- Use WebSocket connection to update sketch data incrementally
- Provide plug-in interface to implement something interesting, e.g., dynamic figure, digital clock. See
clock.py
as a demo. - Easy-to-use tools to convert images to drawing tasks
- Python 3.6
- pillow
- colormath
- aiohttp>=2.2.0
- pendulum
generate.py
: generate drawing tasks file for draw_pixel.py and guard.pydraw_pixel.py
: draw every pixel of a drawing task in orderguard.py
: guard a drawing task with passive and active recovering. The passive recovering compares the sketch board and drawing task at start, recovers the polluted pixels in order. The active recovering watches the region of drawing task, recovers the polluted pixel immediately once it appearsprocess_image.py
: scans a image, converts colors that are not available in palette with the nearest available colors. It is based on LAB color space.merge_tasks.py
: merge and sort multiple task files into a single task file.download.py
: download the current sketch board as a GIF image filerecord.py
: download and save the sketch board every 3 minutes. It is used to record the drawing process, which can be used to create video later.
Run following command,
python3 -m pip install -r requirements.txt
- Open Chrome DevTools, switch to the Network tab
- Draw a arbitrary pixel on the sketch board
- Locate the POST request named draw and right click the mouse on it
- Select
Copy
->Copy as cURL (bash)
, paste and save the content in a text file, e.g.,users.txt
- If you have other accounts, login your account and do step 1-4 again. Save each content in a single line. You can have blank line or add comment line with leading
#
-
Prepare you image with your favorite Image Editor, and save the image as a PNG file, e.g.,
foo.png
. If you don't want to include some regions in your image, leave those regions transparent -
If you are not sure whether this image contains unavailable colors, process your image with command,
process_image.py foo.png foo_processed.png
-
Note down the top-left coordinate
(x1, y1)
at where you want to place your image -
Run following command to generate the task file
mytask.json
,generate.py -o mytask.json --pattern foo.png --topleft x1 y1
-
Finally, run following command to start the task,
guard.py mytask.json users.txt