Spaces:
Runtime error
Runtime error
Commit Β·
374aa7f
1
Parent(s): 54d09f0
Chore: remove cf-worker (CF IPs also blocked by Instagram)
Browse filesCo-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- CLAUDE.md +1 -1
- README.md +1 -1
- deploy/cf-worker/worker.js +0 -71
CLAUDE.md
CHANGED
|
@@ -180,7 +180,7 @@ is `deploy/hf-spaces/TASKS.md`. Non-obvious bits:
|
|
| 180 |
- **Env vars:** `OLLAMA_ENABLED`, `OLLAMA_URL`, `HOSTED`, `NOMINATIM_URL`,
|
| 181 |
`JOB_TTL_HOURS`, `MAX_CONCURRENT_JOBS` (2), `MAX_UPLOAD_MB` (25), `MAX_POSTS`
|
| 182 |
(5000), `ANTHROPIC_API_KEY`, `CAPTION_PROXY_URL` (reserved; Instagram blocks all
|
| 183 |
-
cloud IPs
|
| 184 |
Hosted template: `deploy/hosted.env.example`.
|
| 185 |
- **Models:** default to the latest/most capable Claude when relevant. Anthropic
|
| 186 |
IDs live in `pipeline/extract.py:MODELS`; Ollama in `MODELS_OLLAMA`.
|
|
|
|
| 180 |
- **Env vars:** `OLLAMA_ENABLED`, `OLLAMA_URL`, `HOSTED`, `NOMINATIM_URL`,
|
| 181 |
`JOB_TTL_HOURS`, `MAX_CONCURRENT_JOBS` (2), `MAX_UPLOAD_MB` (25), `MAX_POSTS`
|
| 182 |
(5000), `ANTHROPIC_API_KEY`, `CAPTION_PROXY_URL` (reserved; Instagram blocks all
|
| 183 |
+
cloud IPs β URL feature is local Docker only for now).
|
| 184 |
Hosted template: `deploy/hosted.env.example`.
|
| 185 |
- **Models:** default to the latest/most capable Claude when relevant. Anthropic
|
| 186 |
IDs live in `pipeline/extract.py:MODELS`; Ollama in `MODELS_OLLAMA`.
|
README.md
CHANGED
|
@@ -300,7 +300,7 @@ Then open [http://localhost:8000](http://localhost:8000).
|
|
| 300 |
|
| 301 |
The UI lets you:
|
| 302 |
- **Drag-and-drop** your Instagram export zip (or `saved_posts.json` directly) β zip is extracted in-browser, no unzipping needed
|
| 303 |
-
- **Single post URL** β paste any `https://www.instagram.com/p/β¦` URL directly in the upload card (below the drop zone) to extract one place without needing a full export. Works in the local Docker build
|
| 304 |
- **Pick a provider** β three options available (see below)
|
| 305 |
- **Watch real-time progress** as posts are extracted, geocoded, and mapped
|
| 306 |
- **Three-tab layout visible from first load** β the app shows three top-level tabs:
|
|
|
|
| 300 |
|
| 301 |
The UI lets you:
|
| 302 |
- **Drag-and-drop** your Instagram export zip (or `saved_posts.json` directly) β zip is extracted in-browser, no unzipping needed
|
| 303 |
+
- **Single post URL** β paste any `https://www.instagram.com/p/β¦` URL directly in the upload card (below the drop zone) to extract one place without needing a full export. Works in the local Docker build only β Instagram blocks all cloud server IPs (including Cloudflare Workers), so the hosted build shows an immediate error and redirects to chatbot mode.
|
| 304 |
- **Pick a provider** β three options available (see below)
|
| 305 |
- **Watch real-time progress** as posts are extracted, geocoded, and mapped
|
| 306 |
- **Three-tab layout visible from first load** β the app shows three top-level tabs:
|
deploy/cf-worker/worker.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
| 1 |
-
/**
|
| 2 |
-
* Cloudflare Worker β Instagram caption relay
|
| 3 |
-
*
|
| 4 |
-
* Fetches the /embed/captioned/ version of an Instagram post URL and returns
|
| 5 |
-
* the HTML wrapped in {"contents": "<html>β¦"} so the app's _fetch_via_proxy()
|
| 6 |
-
* can parse it. Cloudflare's edge IPs are legitimate CDN IPs that Instagram
|
| 7 |
-
* cannot block without breaking embedded posts on every website.
|
| 8 |
-
*
|
| 9 |
-
* Deploy: https://dash.cloudflare.com β Workers & Pages β Create β paste this
|
| 10 |
-
* Usage: https://your-worker.workers.dev?url=https://www.instagram.com/p/β¦
|
| 11 |
-
*/
|
| 12 |
-
|
| 13 |
-
export default {
|
| 14 |
-
async fetch(request) {
|
| 15 |
-
// CORS preflight
|
| 16 |
-
if (request.method === 'OPTIONS') {
|
| 17 |
-
return new Response(null, {
|
| 18 |
-
headers: {
|
| 19 |
-
'Access-Control-Allow-Origin': '*',
|
| 20 |
-
'Access-Control-Allow-Methods': 'GET',
|
| 21 |
-
},
|
| 22 |
-
});
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
const { searchParams } = new URL(request.url);
|
| 26 |
-
const url = searchParams.get('url');
|
| 27 |
-
|
| 28 |
-
if (!url) {
|
| 29 |
-
return json({ error: 'Missing ?url= parameter' }, 400);
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
// Only relay Instagram post/reel/tv URLs
|
| 33 |
-
const m = url.match(
|
| 34 |
-
/(https?:\/\/(?:www\.)?instagram\.com\/(?:p|reel|tv)\/[\w-]+)/
|
| 35 |
-
);
|
| 36 |
-
if (!m) {
|
| 37 |
-
return json({ error: 'Not an Instagram post URL' }, 400);
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
-
const embedUrl = m[1].replace(/\/$/, '') + '/embed/captioned/';
|
| 41 |
-
|
| 42 |
-
let resp;
|
| 43 |
-
try {
|
| 44 |
-
resp = await fetch(embedUrl, {
|
| 45 |
-
headers: {
|
| 46 |
-
'User-Agent':
|
| 47 |
-
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
| 48 |
-
Accept:
|
| 49 |
-
'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
| 50 |
-
'Accept-Language': 'en-US,en;q=0.9',
|
| 51 |
-
Referer: 'https://www.google.com/',
|
| 52 |
-
},
|
| 53 |
-
});
|
| 54 |
-
} catch (err) {
|
| 55 |
-
return json({ error: `Fetch failed: ${err.message}` }, 502);
|
| 56 |
-
}
|
| 57 |
-
|
| 58 |
-
const html = await resp.text();
|
| 59 |
-
return json({ contents: html });
|
| 60 |
-
},
|
| 61 |
-
};
|
| 62 |
-
|
| 63 |
-
function json(data, status = 200) {
|
| 64 |
-
return new Response(JSON.stringify(data), {
|
| 65 |
-
status,
|
| 66 |
-
headers: {
|
| 67 |
-
'Content-Type': 'application/json',
|
| 68 |
-
'Access-Control-Allow-Origin': '*',
|
| 69 |
-
},
|
| 70 |
-
});
|
| 71 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|