This folder is a standalone local service for Midjourney Explore search and feed access.
It is intentionally decoupled from dnews runtime:
- no
dnewsqueue - no
dnewsbackend API - no
dnewsdatabase dependency
The service runs locally, opens a persistent Chrome profile, and uses the logged-in browser context to query Midjourney Explore APIs.
- report browser/login health
- open the Midjourney Explore page in Chrome
- search Explore images by keyword
- fetch
styles_top - fetch
video_top
These are the Midjourney endpoints verified during local testing:
GET /api/explore-vector-search?prompt=<keyword>&page=<n>&_ql=exploreGET /api/explore-srefs?page=<n>&_ql=explore&feed=styles_topGET /api/explore?page=<n>&feed=video_top&_ql=explore
GET /healthGET /api/login/statusPOST /api/browser/openGET /api/explore/search?prompt=red&page=1GET /api/explore/styles-top?page=1GET /api/explore/video-top?page=1
- Search result items do not include a detail page URL field directly.
- A usable detail page can be derived as:
https://www.midjourney.com/jobs/<id>
Example:
https://www.midjourney.com/jobs/bd6d4e48-8a7c-4d18-b14a-0b62f1fe45f0
Midjourney blocks plain backend scraping with Cloudflare and auth checks.
The stable path is:
- launch a persistent Chrome profile
- keep the user logged in interactively
- open Midjourney Explore in that profile
- execute same-origin
fetchcalls from the page context
Earlier DOM-driven search automation was more fragile. The current implementation avoids depending on the search input DOM and calls the verified Explore endpoints directly from the logged-in browser page context.
package.json: project metadata and scriptssrc/server.ts: local HTTP server and route handlingsrc/browser.ts: Midjourney browser session and API fetch logicsrc/config.ts: runtime config parsingsrc/types.ts: response and status typessrc/utils.ts: helper functions.env.example: environment templateREADME.md: quickstart
cd midjourney-agent
npm install
cp .env.example .env
npm run startUse a dedicated Chrome profile for the agent.
Recommended env:
MJ_USER_DATA_DIR="$HOME/.dnews-midjourney-profile/explore-debug"
MJ_HEADLESS=falseMJ_HEADLESS=false is recommended because:
- first-time login and Cloudflare challenge are easier to complete
- debugging is simpler
- some flows are more reliable with a visible browser
- start the service
- call
POST /api/browser/open - complete Midjourney login / Cloudflare in the Chrome window if needed
- call search
Example:
curl -X POST http://127.0.0.1:18123/api/browser/open
curl "http://127.0.0.1:18123/api/explore/search?prompt=red&page=1"search=red page=1 was verified successfully.
The service hit:
https://www.midjourney.com/api/explore-vector-search?prompt=red&page=1&_ql=explore
and returned 200 OK.
This should be deployed as a local or workstation-side bot, not as a pure remote backend crawler.
Reason:
- Midjourney login is tied to a real browser session
- Cloudflare challenges need browser state
- credentials and cookies live in the Chrome profile
Deployment expectations:
- macOS preferred
- Google Chrome installed
- interactive browser access available
- persistent disk for the Chrome profile directory
- No task queue yet
- No persistence layer yet for search results
- No admin UI yet
loginStateis heuristic, based on current page content/url- Midjourney may change DOM or endpoint contracts
- add normalized output format with
detail_url - add file/SQLite persistence
- add batch pagination fetch
- add simple auth token in front of the local API if needed
- add one-click startup shell script for operators