pixivembed.py Documentation#
pixivembed.py is a Python script that fetches metadata from pixiv and generates a static HTML embed card. By default, the script runs silently, automatically copies the generated HTML to your clipboard, and saves it to a file named pixivembed.html in the same directory.
Maintained by Ufal Salman.
The documentation is also available here and here.
Based on PixivPy3 API
Output Examples#
- pixivembed-proxy-sfw.html
- pixivembed-proxy-multi-sfw.html
- pixivembed-base64-sfw.html
- pixivembed-base64-multi-sfw.html
- pixivembed-proxy-r18.html
- pixivembed-proxy-multi-r18.html
- pixivembed-base64-r18.html
- pixivembed-base64-multi-r18.html
- pixivembed-proxy-grid-sfw.html
- pixivembed-proxy-scroll-sfw.html
- pixivembed-proxy-blur-r18.html
- pixivembed-proxy-pages-sfw.html
- pixivembed-proxy-range-sfw.html
- pixivembed-lc-sfw.html
Download#
Get it here.
CSS#
You can use the CSS template here if you want to modify and host it yourself.
Important Notice#
Note: You must create a text file named token.txt in the same directory as the script and paste your own pixiv token inside it before running the script, otherwise authentication will fail. See this guide for further information.
Prerequisites#
Make sure you have the required libraries installed on your system:
pip install pixivpy3 Pillow
Note: The Pillow library is only required if you plan to use the local image download/conversion option (-l).
Usage#
python pixivembed.py <URL-or-ID> [options]
Basic Examples#
python pixivembed.py 11223344
python pixivembed.py https://www.pixiv.net/en/artworks/11223344
Available Options#
-nc: Generates raw HTML without the inline<style>block.-lc: Replaces the style block with a<link rel="stylesheet">tag pointing to an external CSS file from this website.-l: Downloads the illustrations locally, converts them to WebP format, and embeds them directly into the HTML code as Base64 strings.-g4: Arranges the images in a grid layout and limits the output to a maximum of 4 images.-s: Sets a fixed maximum height (400px) and makes the image container scrollable.-b: Applies a blur effect to all images. Hover over the image to unblur.-p <pages>: Includes only specific page numbers (1-based index, e.g.,-p 1,3,4).-pa <start>: Sets the starting page for a range (e.g.,-pa 2).-pb <end>: Sets the ending page for a range (e.g.,-pb 5).
OS-Specific Guidelines#
1. Windows#
- Open Command Prompt (CMD) or PowerShell.
- Run the script using the standard commands.
- The automatic clipboard functionality uses the native Windows API via
ctypes, so it works out of the box with no extra software required.
2. macOS#
- Open Terminal.
- The clipboard functionality automatically channels the output through the native
pbcopycommand. - No additional configuration is needed.
3. Linux#
- Open your system Terminal.
- To allow the script to automatically copy the HTML to your clipboard, your system needs either
xcliporxselinstalled. - You can install
xclipvia your package manager (e.g., on Debian/Ubuntu):
sudo apt install xclip
Note for Linux Users: If neither
xclipnorxselis present, the script will still run perfectly fine and output the code to the terminal, but the automatic copy-to-clipboard step will be skipped.