Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/osctorand/lightshotscrape/llms.txt

Use this file to discover all available pages before exploring further.

The Python CLI provides two modes for scraping random Lightshot images: single image mode and loop mode.
The main.py script is currently a work in progress. The core functionality is available in singleImage.py, which can be used directly for single image scraping. The mode selection feature in main.py is not yet fully implemented.

Prerequisites

Before using the CLI, ensure you have:
  • Python 3.x installed
  • Required dependencies installed (see Installation)
  • Write permissions to the Pictures folder

Command syntax

The CLI requires a mode argument to specify how it should operate:
python main.py -m <mode>

Available modes

Use -m en to scrape a single random image:
python main.py -m en
This mode will:
  • Generate one random Lightshot URL
  • Download the image if available
  • Save it to your Pictures folder
  • Exit after completion

Usage examples

1

Navigate to the project directory

Open your terminal and navigate to the lightshotscrape folder:
cd path/to/lightshotscrape
2

Run the scraper

Execute the script with your desired mode:
python main.py -m en
3

Check your saved images

Images are automatically saved to:
C:\Users\%username%\Pictures\Saved Pictures

How it works

The scraper uses the following process:
  1. URL Generation: Creates random 12-character strings using letters (a-z, A-Z) and digits (0-9)
  2. URL Format: Constructs URLs in the format https://prnt.sc/{random-string}
  3. Page Scraping: Uses BeautifulSoup and cloudscraper to extract image URLs from the page
  4. Image Download: Downloads the actual image file from the extracted URL
  5. Save: Stores the image in the configured directory
The tool uses cloudscraper to bypass Cloudflare protection on the Lightshot website.

Error handling

If you run the command without specifying a mode, you’ll see:
Ange inställning ('-m en' eller '-m loop')
This Swedish message translates to “Enter setting (‘-m en’ or ‘-m loop’)”.
Always include the -m flag with either en or loop as the mode argument.

Sample output

When running the script, you’ll see the parsed arguments:
$ python main.py -m en
([('-m', 'en')], [])
# Script proceeds to scrape one image
$ python main.py -m loop
([('-m', 'loop')], [])
# Script continuously scrapes images until stopped

Stopping the loop mode

To stop the continuous loop mode, press Ctrl+C in your terminal:
^C
KeyboardInterrupt

Default save location

All scraped images are saved to:
C:\Users\%username%\Pictures\Saved Pictures
Where %username% is automatically replaced with your Windows username.
The save path is currently hardcoded in main.py:25. There was previously an option to customize it via input, but it’s now commented out.

Next steps

Windows GUI

Use the graphical interface for easier operation

Installation

Set up the tool on your system