assets-only root README
Browse files
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
emoji: π
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: green
|
|
@@ -8,17 +8,16 @@ pinned: false
|
|
| 8 |
app_port: 7860
|
| 9 |
---
|
| 10 |
|
| 11 |
-
#
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
|
| 16 |
-
##
|
| 17 |
|
| 18 |
-
### `POST /assets`
|
| 19 |
|
| 20 |
-
Give it a URL, get back the page's assets grouped by
|
| 21 |
-
**image Β· video Β· audio Β· svg_icon Β· font**.
|
| 22 |
|
| 23 |
```bash
|
| 24 |
curl -X POST https://lljz66-api.hf.space/assets \
|
|
@@ -41,7 +40,7 @@ curl -X POST https://lljz66-api.hf.space/assets \
|
|
| 41 |
}
|
| 42 |
```
|
| 43 |
|
| 44 |
-
|
| 45 |
|
| 46 |
| field | type | default | meaning |
|
| 47 |
|-------|------|---------|---------|
|
|
@@ -49,46 +48,30 @@ Optional request fields:
|
|
| 49 |
| `include_data_uris` | bool | `false` | keep `data:` URIs |
|
| 50 |
| `groups` | list[string] | all | subset: `image`, `video`, `audio`, `svg_icon`, `font` |
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
### `POST /scrape`
|
| 55 |
-
Scrape a website's clean content via Firecrawl.
|
| 56 |
-
|
| 57 |
-
```bash
|
| 58 |
-
curl -X POST https://lljz66-api.hf.space/scrape \
|
| 59 |
-
-H 'Content-Type: application/json' \
|
| 60 |
-
-d '{"url": "https://example.com"}'
|
| 61 |
-
```
|
| 62 |
-
|
| 63 |
-
### `GET /map`
|
| 64 |
-
Discover a website's URLs via sitemap + katana crawler.
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
``
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
```bash
|
| 74 |
-
curl "https://lljz66-api.hf.space/favicon?url=https://example.com"
|
| 75 |
-
```
|
| 76 |
|
| 77 |
-
|
| 78 |
-
Service status.
|
| 79 |
-
|
| 80 |
-
### `GET /debug/katana`
|
| 81 |
-
Diagnose katana crawler flags.
|
| 82 |
|
| 83 |
## Structure (monolith-modular)
|
| 84 |
|
| 85 |
```
|
| 86 |
app/
|
| 87 |
βββ main.py # FastAPI app assembly
|
| 88 |
-
βββ config.py # settings
|
| 89 |
βββ schemas.py # pydantic request/response models
|
| 90 |
-
βββ routers/
|
| 91 |
-
βββ
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
βββ extractors/ # images, videos, audios, icons_svg, fonts
|
| 93 |
```
|
| 94 |
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Asset Extractor API
|
| 3 |
emoji: π
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: green
|
|
|
|
| 8 |
app_port: 7860
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# Asset Extractor API
|
| 12 |
|
| 13 |
+
FastAPI service that extracts assets from any URL, grouped by type:
|
| 14 |
+
**image Β· video Β· audio Β· svg/icon Β· font**.
|
| 15 |
|
| 16 |
+
## Usage
|
| 17 |
|
| 18 |
+
### `POST /assets`
|
| 19 |
|
| 20 |
+
Give it a URL, get back the page's assets grouped by category.
|
|
|
|
| 21 |
|
| 22 |
```bash
|
| 23 |
curl -X POST https://lljz66-api.hf.space/assets \
|
|
|
|
| 40 |
}
|
| 41 |
```
|
| 42 |
|
| 43 |
+
### Request fields
|
| 44 |
|
| 45 |
| field | type | default | meaning |
|
| 46 |
|-------|------|---------|---------|
|
|
|
|
| 48 |
| `include_data_uris` | bool | `false` | keep `data:` URIs |
|
| 49 |
| `groups` | list[string] | all | subset: `image`, `video`, `audio`, `svg_icon`, `font` |
|
| 50 |
|
| 51 |
+
### Response fields
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
+
| field | type | meaning |
|
| 54 |
+
|-------|------|---------|
|
| 55 |
+
| `url` | string | final URL after redirects |
|
| 56 |
+
| `title` | string \| null | page title |
|
| 57 |
+
| `total` | int | total asset count |
|
| 58 |
+
| `assets` | object | grouped asset URL lists |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
+
> Static HTML only β JS-rendered assets are not captured.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
## Structure (monolith-modular)
|
| 63 |
|
| 64 |
```
|
| 65 |
app/
|
| 66 |
βββ main.py # FastAPI app assembly
|
| 67 |
+
βββ config.py # settings (fetch limits, SSRF block-list)
|
| 68 |
βββ schemas.py # pydantic request/response models
|
| 69 |
+
βββ routers/
|
| 70 |
+
β βββ assets.py # POST /assets (HTTP layer)
|
| 71 |
+
βββ services/
|
| 72 |
+
βββ fetcher.py # safe async page fetch (SSRF/size/timeout guards)
|
| 73 |
+
βββ resolver.py # absolutize asset references
|
| 74 |
+
βββ asset_service.py # orchestrator: fetch -> parse -> extract -> group
|
| 75 |
βββ extractors/ # images, videos, audios, icons_svg, fonts
|
| 76 |
```
|
| 77 |
|