This reference documents all core functions in the Lightshot Scrape Python CLI tool. These functions handle URL generation, image extraction, and verification.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.
ImageLinkGenerator
Generates a random Lightshot URL by creating a random 12-character string.Signature
Parameters
This function takes no parameters.Returns
A random Lightshot URL in the format
https://prnt.sc/{random_string} where random_string is a 12-character combination of uppercase letters, lowercase letters, and digits.Implementation details
The function generates a random 12-character string using:- Lowercase letters (a-z)
- Uppercase letters (A-Z)
- Digits (0-9)
https://prnt.sc/ to create a valid Lightshot URL.
Example
ImageHandler
Extracts the actual image URL from a Lightshot page by scraping the HTML and finding the image source.Signature
Parameters
The Lightshot URL to scrape (e.g.,
https://prnt.sc/abc123)Returns
The direct image URL extracted from the Lightshot page, or
None if an error occurs. The image URL typically points to the CDN where the actual image is hosted.Implementation details
The function:- Creates a cloudscraper instance to bypass Cloudflare protection
- Fetches the HTML content of the Lightshot page
- Parses the HTML using BeautifulSoup
- Finds the first
<img>tag and extracts itssrcattribute - Returns the image URL or prints an error if something fails
Example
Dependencies
- cloudscraper: Used to bypass Cloudflare protection on Lightshot pages
- BeautifulSoup: Parses HTML to extract image tags
- requests: HTTP library (used indirectly through cloudscraper)
The function catches all exceptions and prints them to stdout, but does not raise them. Make sure to check if the return value is
None before using it.ImageVerifier
Verifies the validity of an image URL (currently a placeholder function).Signature
Parameters
The image URL to verify
Returns
Currently returns
None as this function is not yet implemented.Implementation details
Example
Future implementation suggestions
Future implementation suggestions
This function could be implemented to:
- Check if the image URL is accessible (HTTP 200 status)
- Verify the content type is an image
- Check if the image is a valid image file (not a 404 placeholder)
- Validate image dimensions or file size
- Filter out Lightshot’s default “image not found” placeholder