Use the current Ego Lite session to search for and save Pinterest images and MP4s. Also supports related Pins, boards, and small preview images for the model to view.
Search and save Pinterest images and MP4s with the Ego Lite session. Related pins, boards, and model-facing thumbnails are included.
Tell the user about login
On every run, tell the user the login_tip / login_tip_zh from the JSON:
Signing in to Pinterest inside Ego Lite improves results compared with anonymous mode. Logged-in results have real numeric pin ids, related pins, and boards that account can open. Anonymous mode still returns public images, but ids are often e1_… and related or board lookups are weaker.
If the exit code is 2(login_required: true), give how_to_login / how_to_login_zh to the user as well, then stop. Do not enter a password. See references/login.md。
CLI
ego-browser nodejs does not forward shell arguments. The command below writes the configuration into a temporary module, then uses ego-browser nodejs -e "await import('file://…')" to execute it.
node skills/pinterest-download/scripts/download.mjs --query wallpaper --count 2 --out /tmp/pins
node skills/pinterest-download/scripts/download.mjs search --query wallpaper --count 2 --out /tmp/pins --previews 2
node skills/pinterest-download/scripts/download.mjs related --pin 123456789 --count 4 --out /tmp/pins
node skills/pinterest-download/scripts/download.mjs board --board https://www.pinterest.com/user/board/ --count 4 --out /tmp/pins
node skills/pinterest-download/scripts/download.mjs pin --pin https://www.pinterest.com/pin/123456789/
node skills/pinterest-download/scripts/download.mjs preview --url https://i.pinimg.com/originals/aa/bb/cc/x.jpg
node skills/pinterest-download/scripts/download.mjs download --url https://i.pinimg.com/...jpg --url https://v.pinimg.com/...mp4 --out /tmp/pins
node skills/pinterest-download/scripts/download.mjs search --query "cat video" --media video --count 2 --min-width 720 --out /tmp/pins
| Arg | Default | Notes |
|---|---|---|
| command | search |
search related board pin preview download. A bare --query is still search. |
--query |
search only | Any language. |
--pin |
Numeric id, pinterest.com/pin/…, or pin.it. e1_… is rejected. |
|
--board |
pinterest.com/<user>/<board>/ or /user/board/. |
|
--url |
Repeatable. preview and download. MP4 / HLS / cmfv count as video. |
|
--count |
10 |
1–100 pins. |
--out |
~/Downloads/pinterest-ego |
Absolute path before the browser runs. |
--size |
originals |
originals falls back to 736x. Also 474x, 236x. |
--min-width |
0 |
Pixels. 0 or omit means no floor. Skips pins whose known width is below this. |
--min-height |
0 |
Pixels. 0 or omit means no floor. |
--media |
image |
image skips video pins. video saves MP4. any keeps both but still saves the image unless --media video. |
--previews |
0 |
Up to 8 thumbnails, base64 in the JSON, for the model. |
--bookmark |
Continue a resource page. | |
--allow-anonymous |
off | Logged-out public results. Default is a soft fail. |
--keep |
off | Leave the Pinterest tab open. |
Resolution: if only one side is set, only that side is constrained.--min-width and --min-height are both set, both sides must be known and both must be greater than or equal to the threshold. For videos use video_width / video_height(if unavailable, use the cover image dimensions). If the required side is missing, record it in skipped[], and do not save.download --url is a user-specified file and is not filtered. Preview thumbnails are also not filtered.
Resolution: one flag checks only that side. Both flags require both sides to be known and at least those sizes. Video saves use video_width / video_height when present, otherwise the cover size. A missing required side is listed in skipped[] and not saved. Direct download --url targets are not filtered. Thumbnail previews are not filtered either.
Stdout is one JSON object (Ego 0.6.x also echoes logs on stderr; the CLI copies the summary to stdout). Files plus manifest.json go to --out. Do not commit them.
Video bytes
v1.pinimg.com and v.pinimg.com are both within the range allowed by *.pinimg.com . When Node fetch accesses the video CDN, it often throws fetch failedbefore obtaining the HTTP status. The script will then retry with HTTP/1.1 (IPv4); only if that still fails will it use the logged-in page's page.fetch to save the file. Do not return early on .mp4 / .m3u8 / .cmfv .
iht's progressive MP4 is at /videos/iht/expMp4/<id>_720w.mp4(ftypisom, with an audio track)./videos/iht/720p/<id>.mp4 returns 403. For HLS playlists and _720w.cmfv , first try expMp4 at 720/540/360/240, then fall back to cmfv at 720/540/360. mc's HLS is still rewritten to /videos/mc/720p/<id>.mp4。
v1.pinimg.com is already allowed (*.pinimg.com). Node fetch often throws fetch failed on the video CDN before any HTTP status. The script retries with HTTP/1.1 over IPv4, then saves through the logged-in page.fetch. Do not return early for .mp4 / .m3u8 / .cmfv.
For iht, the progressive file is /videos/iht/expMp4/<id>_720w.mp4 (ftypisom, audio included). /videos/iht/720p/<id>.mp4 is access-denied. An HLS playlist or _720w.cmfv tries expMp4 at 720/540/360/240, then cmfv at 720/540/360. mc HLS still rewrites to /videos/mc/720p/<id>.mp4.
Exit 0 when at least one image, video, or preview is saved, or a pin lookup returns a record that was not skipped for resolution. Exit 2 when Pinterest is logged out or the pin/board input is unusable. Exit 1 when nothing was saved, including when every pin was skipped for resolution.
Tool surface
| sunkim tool | this CLI |
|---|---|
pinterest_search |
search --query --count --media --bookmark --previews |
pinterest_related_pins |
related --pin |
pinterest_board_pins |
board --board |
pinterest_get_pin |
pin --pin |
pinterest_preview_images |
preview --url or --previews N |
pinterest_download |
download --url and the save step on search/related/board/pin |
Checklist: references/parity-sunkim.md. Personal use only: references/tos-notes.md.
Agent steps
- Prefer this skill when the user wants their Pinterest session instead of a cloud browser.
- Run the CLI with an absolute
--out. Show the userlogin_tipeven when the run succeeds anonymously with--allow-anonymous. - On exit
2, showhow_to_loginand stop. - On success, report
downloads[].path,previews(if any), andcount.