@capyclaw/scrapling 1.0.2 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +124 -210
- package/client/client.js +138 -9
- package/cordis.patch.yml +10 -1
- package/demo/news.html +53 -0
- package/demo/products.html +68 -0
- package/demo/quotes.html +72 -0
- package/lib/crawler.mjs +370 -0
- package/lib/host.mjs +109 -34
- package/lib/html-parser.mjs +286 -0
- package/lib/index.mjs +4 -1
- package/lib/selectors.mjs +427 -0
- package/package.json +14 -6
- package/server/server.mjs +253 -0
- package/ui/app.js +663 -0
- package/ui/index.html +169 -0
- package/ui/style.css +241 -0
package/ui/index.html
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>DSH 爬虫工作台 · 看得见的数据爬取</title>
|
|
7
|
+
<link rel="stylesheet" href="/style.css">
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<header class="topbar">
|
|
11
|
+
<div class="brand">
|
|
12
|
+
<span class="logo">🕷️</span>
|
|
13
|
+
<div>
|
|
14
|
+
<h1>DSH 爬虫工作台</h1>
|
|
15
|
+
<p class="subtitle">看得见的数据爬取 —— 每一步都实时呈现</p>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="topbar-right">
|
|
19
|
+
<span id="health-pill" class="pill pill-unknown">检查服务中…</span>
|
|
20
|
+
<a class="help-link" href="#关于本工具" title="能力说明">ⓘ 能力说明</a>
|
|
21
|
+
</div>
|
|
22
|
+
</header>
|
|
23
|
+
|
|
24
|
+
<main>
|
|
25
|
+
<!-- ============ 第一步:选择目标 ============ -->
|
|
26
|
+
<section class="card" id="card-target">
|
|
27
|
+
<div class="card-head">
|
|
28
|
+
<span class="step-no">①</span>
|
|
29
|
+
<div>
|
|
30
|
+
<h2>选择要爬取的网页</h2>
|
|
31
|
+
<p class="card-desc">输入任意网址,或点一个演示目标马上体验(内置演示无需外网)。</p>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<div class="target-row">
|
|
36
|
+
<label class="mode-switch" title="当前版本仅支持 HTTP 直连抓取">
|
|
37
|
+
<input type="radio" name="mode" value="http" checked>
|
|
38
|
+
<span>HTTP 抓取</span>
|
|
39
|
+
</label>
|
|
40
|
+
<label class="mode-switch mode-disabled" title="浏览器渲染模式未实现:依赖外部 Python scrapling 运行时">
|
|
41
|
+
<input type="radio" name="mode" value="browser" disabled>
|
|
42
|
+
<span>浏览器渲染 🔒</span>
|
|
43
|
+
</label>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<form id="crawl-form" class="crawl-form">
|
|
47
|
+
<div class="url-row">
|
|
48
|
+
<input id="url-input" type="text" inputmode="url" placeholder="例如:http://127.0.0.1:39640/demo/quotes.html"
|
|
49
|
+
autocomplete="off" spellcheck="false" required>
|
|
50
|
+
<button type="submit" id="crawl-btn" class="btn btn-primary">开始爬取</button>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<div class="demo-chips" id="demo-chips">
|
|
54
|
+
<span class="chips-label">演示目标:</span>
|
|
55
|
+
<button type="button" class="chip" data-url="/demo/quotes.html" data-kind="quotes">📚 每日名言</button>
|
|
56
|
+
<button type="button" class="chip" data-url="/demo/products.html" data-kind="products">🛒 好物清单</button>
|
|
57
|
+
<button type="button" class="chip" data-url="/demo/news.html" data-kind="news">📰 科技早报</button>
|
|
58
|
+
<button type="button" class="chip chip-ext" data-url="https://quotes.toscrape.com/" data-kind="ext-quotes">🌍 真实网站·英文名言站(需外网)</button>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<details class="advanced">
|
|
62
|
+
<summary>高级选项(可不改)</summary>
|
|
63
|
+
<div class="advanced-grid">
|
|
64
|
+
<label>超时时间(毫秒)
|
|
65
|
+
<input id="timeout-input" type="number" min="1000" max="120000" step="1000" value="20000">
|
|
66
|
+
</label>
|
|
67
|
+
<label>User-Agent(浏览器标识)
|
|
68
|
+
<input id="ua-input" type="text" placeholder="留空使用默认 UA">
|
|
69
|
+
</label>
|
|
70
|
+
</div>
|
|
71
|
+
</details>
|
|
72
|
+
</form>
|
|
73
|
+
</section>
|
|
74
|
+
|
|
75
|
+
<!-- ============ 第二步:观察流程 ============ -->
|
|
76
|
+
<section class="card card-hidden" id="card-pipeline">
|
|
77
|
+
<div class="card-head">
|
|
78
|
+
<span class="step-no">②</span>
|
|
79
|
+
<div>
|
|
80
|
+
<h2>DSH 是怎么爬到数据的</h2>
|
|
81
|
+
<p class="card-desc">下面是本次爬取的每个环节与真实耗时(按实际时间轴回放)。</p>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
<ol class="pipeline" id="pipeline"></ol>
|
|
85
|
+
<div id="crawl-error" class="error-banner banner-hidden"></div>
|
|
86
|
+
<div id="page-summary" class="page-summary summary-hidden"></div>
|
|
87
|
+
</section>
|
|
88
|
+
|
|
89
|
+
<!-- ============ 第三步:提取数据 ============ -->
|
|
90
|
+
<section class="card card-hidden" id="card-extract">
|
|
91
|
+
<div class="card-head">
|
|
92
|
+
<span class="step-no">③</span>
|
|
93
|
+
<div>
|
|
94
|
+
<h2>用选择器把数据取出来</h2>
|
|
95
|
+
<p class="card-desc">CSS 选择器告诉 DSH 要抓页面里的哪些数据;<code>::text</code> 取文字、<code>::attr(名)</code> 取属性。点演示目标会自动配好示例。</p>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
<div class="selector-rows" id="selector-rows"></div>
|
|
100
|
+
<div class="extract-actions">
|
|
101
|
+
<button type="button" id="add-field-btn" class="btn btn-ghost">+ 添加字段</button>
|
|
102
|
+
<button type="button" id="extract-btn" class="btn btn-primary">提取数据</button>
|
|
103
|
+
</div>
|
|
104
|
+
<p class="selector-tip">
|
|
105
|
+
常用写法:<code>.price::text</code>(类名 price 的文字)·
|
|
106
|
+
<code>a::attr(href)</code>(所有链接地址)·
|
|
107
|
+
<code>table.summary tr td:nth-child(2)::text</code>(表格第 2 列)
|
|
108
|
+
</p>
|
|
109
|
+
|
|
110
|
+
<div id="extract-result" class="extract-result result-hidden">
|
|
111
|
+
<div class="result-tabs">
|
|
112
|
+
<button type="button" class="tab tab-active" data-tab="table">表格</button>
|
|
113
|
+
<button type="button" class="tab" data-tab="json">JSON</button>
|
|
114
|
+
<div class="result-actions">
|
|
115
|
+
<button type="button" id="copy-json-btn" class="btn btn-small">复制 JSON</button>
|
|
116
|
+
<button type="button" id="download-json-btn" class="btn btn-small">下载 JSON</button>
|
|
117
|
+
<button type="button" id="download-csv-btn" class="btn btn-small">导出 CSV(Excel 可开)</button>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
<div id="result-table-wrap" class="result-pane"></div>
|
|
121
|
+
<pre id="result-json" class="result-pane json-pane" hidden></pre>
|
|
122
|
+
<p class="result-note" id="result-note"></p>
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
<details class="raw-html">
|
|
126
|
+
<summary>看看这个网页的原始 HTML(找选择器用)</summary>
|
|
127
|
+
<pre id="raw-html-pre" class="raw-html-pre"></pre>
|
|
128
|
+
</details>
|
|
129
|
+
</section>
|
|
130
|
+
|
|
131
|
+
<!-- ============ 历史 ============ -->
|
|
132
|
+
<section class="card card-hidden" id="card-history">
|
|
133
|
+
<div class="card-head">
|
|
134
|
+
<span class="step-no">🕘</span>
|
|
135
|
+
<div>
|
|
136
|
+
<h2>最近爬取记录</h2>
|
|
137
|
+
<p class="card-desc">点任意一条可以回看当时的流程与数据(服务保留最近 20 条)。</p>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
<div id="history-list" class="history-list"></div>
|
|
141
|
+
</section>
|
|
142
|
+
|
|
143
|
+
<!-- ============ 能力说明 ============ -->
|
|
144
|
+
<section class="card" id="关于本工具">
|
|
145
|
+
<div class="card-head">
|
|
146
|
+
<span class="step-no">ⓘ</span>
|
|
147
|
+
<div>
|
|
148
|
+
<h2>能力说明(诚实边界)</h2>
|
|
149
|
+
<p class="card-desc">本工具当前版本的能力与边界,如实告知:</p>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
<ul class="capability-list">
|
|
153
|
+
<li>✅ <b>HTTP 抓取</b>:直连目标网址获取页面内容,支持重定向跟随与超时控制。</li>
|
|
154
|
+
<li>✅ <b>CSS 选择器提取</b>:纯 Node 实现(无外部依赖),支持 <code>::text</code>、<code>::attr()</code>、组合器与常见伪类。</li>
|
|
155
|
+
<li>✅ <b>数据导出</b>:JSON / CSV,可复制或下载。</li>
|
|
156
|
+
<li>🔒 <b>浏览器渲染</b>:未实现。需要外部 Python <code>scrapling</code> 运行时(隐身浏览器 / Cloudflare 绕过 / JS 渲染),界面上已锁定,不会假装可用。</li>
|
|
157
|
+
<li>🔒 <b>XPath</b>:未实现,同样如实标注。</li>
|
|
158
|
+
<li>🏠 <b>本服务只监听 127.0.0.1</b>,不会暴露到外网。</li>
|
|
159
|
+
</ul>
|
|
160
|
+
</section>
|
|
161
|
+
</main>
|
|
162
|
+
|
|
163
|
+
<footer class="site-footer">
|
|
164
|
+
<p>dsh-scrapling 工作台 · 服务地址 <code id="footer-origin"></code> · <a href="/healthz" target="_blank">健康检查</a></p>
|
|
165
|
+
</footer>
|
|
166
|
+
|
|
167
|
+
<script src="/app.js"></script>
|
|
168
|
+
</body>
|
|
169
|
+
</html>
|
package/ui/style.css
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/* DSH 爬虫工作台 —— 面向普通人的单页界面(无框架、无构建) */
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--bg: #f3f5f9;
|
|
5
|
+
--card: #ffffff;
|
|
6
|
+
--ink: #1f2733;
|
|
7
|
+
--ink-soft: #5b6472;
|
|
8
|
+
--line: #e3e8ef;
|
|
9
|
+
--accent: #3565e0;
|
|
10
|
+
--accent-deep: #24499e;
|
|
11
|
+
--accent-soft: #e8eefb;
|
|
12
|
+
--ok: #1e9e6a;
|
|
13
|
+
--ok-soft: #e2f6ec;
|
|
14
|
+
--warn: #b7791f;
|
|
15
|
+
--warn-soft: #fdf3e0;
|
|
16
|
+
--err: #d64545;
|
|
17
|
+
--err-soft: #fdeaea;
|
|
18
|
+
--skip: #8a94a6;
|
|
19
|
+
--radius: 14px;
|
|
20
|
+
--shadow: 0 1px 3px rgba(31, 39, 51, .07), 0 8px 24px rgba(31, 39, 51, .05);
|
|
21
|
+
--mono: ui-monospace, "Cascadia Code", Consolas, monospace;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
* { box-sizing: border-box; }
|
|
25
|
+
html { scroll-behavior: smooth; }
|
|
26
|
+
body {
|
|
27
|
+
margin: 0;
|
|
28
|
+
background: var(--bg);
|
|
29
|
+
color: var(--ink);
|
|
30
|
+
font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
|
|
31
|
+
font-size: 15px;
|
|
32
|
+
line-height: 1.6;
|
|
33
|
+
}
|
|
34
|
+
code { font-family: var(--mono); background: #eef1f6; border-radius: 4px; padding: 1px 6px; font-size: 13px; }
|
|
35
|
+
pre code { padding: 0; background: none; }
|
|
36
|
+
|
|
37
|
+
/* ---------- 顶栏 ---------- */
|
|
38
|
+
.topbar {
|
|
39
|
+
display: flex; align-items: center; justify-content: space-between;
|
|
40
|
+
padding: 18px 28px; background: linear-gradient(120deg, #24499e, #3565e0);
|
|
41
|
+
color: #fff; box-shadow: var(--shadow);
|
|
42
|
+
}
|
|
43
|
+
.brand { display: flex; align-items: center; gap: 14px; }
|
|
44
|
+
.logo { font-size: 34px; }
|
|
45
|
+
.brand h1 { margin: 0; font-size: 21px; letter-spacing: .5px; }
|
|
46
|
+
.subtitle { margin: 2px 0 0; font-size: 13px; opacity: .85; }
|
|
47
|
+
.topbar-right { display: flex; align-items: center; gap: 14px; }
|
|
48
|
+
.help-link { color: #fff; opacity: .85; text-decoration: none; font-size: 13px; }
|
|
49
|
+
.help-link:hover { opacity: 1; text-decoration: underline; }
|
|
50
|
+
|
|
51
|
+
.pill {
|
|
52
|
+
display: inline-flex; align-items: center; gap: 6px;
|
|
53
|
+
font-size: 12.5px; padding: 4px 12px; border-radius: 999px;
|
|
54
|
+
background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35);
|
|
55
|
+
}
|
|
56
|
+
.pill-ok { background: #123c2a; border-color: #2fbd85; color: #b8f5d9; }
|
|
57
|
+
.pill-ok::before { content: "●"; color: #35d99a; }
|
|
58
|
+
.pill-bad { background: #46191c; border-color: #e07979; color: #ffd3d3; }
|
|
59
|
+
.pill-bad::before { content: "●"; color: #ff8f8f; }
|
|
60
|
+
.pill-unknown::before { content: "●"; color: #d9d9d9; }
|
|
61
|
+
|
|
62
|
+
/* ---------- 布局与卡片 ---------- */
|
|
63
|
+
main { max-width: 1000px; margin: 26px auto 60px; padding: 0 20px; display: grid; gap: 20px; }
|
|
64
|
+
.card {
|
|
65
|
+
background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
|
|
66
|
+
padding: 22px 26px; border: 1px solid var(--line);
|
|
67
|
+
}
|
|
68
|
+
.card-hidden { display: none; }
|
|
69
|
+
.card-head { display: flex; gap: 14px; margin-bottom: 16px; }
|
|
70
|
+
.step-no {
|
|
71
|
+
flex: none; width: 40px; height: 40px; border-radius: 12px;
|
|
72
|
+
display: flex; align-items: center; justify-content: center;
|
|
73
|
+
font-size: 19px; background: var(--accent-soft); color: var(--accent-deep); font-weight: 700;
|
|
74
|
+
}
|
|
75
|
+
.card-head h2 { margin: 0; font-size: 17.5px; }
|
|
76
|
+
.card-desc { margin: 3px 0 0; color: var(--ink-soft); font-size: 13.5px; }
|
|
77
|
+
|
|
78
|
+
/* ---------- 第一步:目标 ---------- */
|
|
79
|
+
.target-row { display: flex; gap: 10px; margin-bottom: 14px; }
|
|
80
|
+
.mode-switch {
|
|
81
|
+
display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
|
|
82
|
+
border: 1.5px solid var(--line); border-radius: 999px; padding: 5px 16px; font-size: 13.5px;
|
|
83
|
+
}
|
|
84
|
+
.mode-switch input { accent-color: var(--accent); }
|
|
85
|
+
.mode-switch:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }
|
|
86
|
+
.mode-disabled { cursor: not-allowed; color: var(--skip); background: #f4f5f7; }
|
|
87
|
+
|
|
88
|
+
.crawl-form .url-row { display: flex; gap: 10px; }
|
|
89
|
+
#url-input {
|
|
90
|
+
flex: 1; font-size: 15px; padding: 11px 15px; border: 1.5px solid var(--line);
|
|
91
|
+
border-radius: 10px; outline: none; font-family: var(--mono); transition: border-color .15s;
|
|
92
|
+
}
|
|
93
|
+
#url-input:focus { border-color: var(--accent); }
|
|
94
|
+
#url-input.invalid { border-color: var(--err); background: #fff7f7; }
|
|
95
|
+
|
|
96
|
+
.btn {
|
|
97
|
+
border: none; border-radius: 10px; padding: 10px 22px; font-size: 14.5px;
|
|
98
|
+
cursor: pointer; font-family: inherit; transition: transform .06s, box-shadow .15s, background .15s;
|
|
99
|
+
}
|
|
100
|
+
.btn:active { transform: translateY(1px); }
|
|
101
|
+
.btn-primary { background: var(--accent); color: #fff; font-weight: 600; }
|
|
102
|
+
.btn-primary:hover { background: var(--accent-deep); }
|
|
103
|
+
.btn-primary:disabled { background: #9db4e8; cursor: wait; }
|
|
104
|
+
.btn-ghost { background: #fff; color: var(--accent-deep); border: 1.5px solid var(--line); }
|
|
105
|
+
.btn-ghost:hover { border-color: var(--accent); }
|
|
106
|
+
.btn-small { background: #fff; color: var(--ink-soft); border: 1.5px solid var(--line); padding: 5px 13px; font-size: 13px; border-radius: 8px; }
|
|
107
|
+
.btn-small:hover { border-color: var(--accent); color: var(--accent-deep); }
|
|
108
|
+
|
|
109
|
+
.demo-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
|
|
110
|
+
.chips-label { color: var(--ink-soft); font-size: 13px; }
|
|
111
|
+
.chip {
|
|
112
|
+
border: 1.5px solid var(--line); background: #fff; border-radius: 999px;
|
|
113
|
+
padding: 5px 15px; font-size: 13.5px; cursor: pointer; font-family: inherit; color: var(--ink);
|
|
114
|
+
transition: border-color .15s, background .15s;
|
|
115
|
+
}
|
|
116
|
+
.chip:hover { border-color: var(--accent); background: var(--accent-soft); }
|
|
117
|
+
.chip.chip-ext { color: var(--ink-soft); }
|
|
118
|
+
|
|
119
|
+
.advanced { margin-top: 14px; font-size: 13.5px; }
|
|
120
|
+
.advanced summary { cursor: pointer; color: var(--ink-soft); user-select: none; }
|
|
121
|
+
.advanced-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; margin-top: 10px; }
|
|
122
|
+
.advanced-grid label { display: grid; gap: 5px; color: var(--ink-soft); font-size: 12.5px; }
|
|
123
|
+
.advanced-grid input {
|
|
124
|
+
font-size: 13.5px; padding: 8px 11px; border: 1.5px solid var(--line); border-radius: 8px; outline: none; font-family: var(--mono);
|
|
125
|
+
}
|
|
126
|
+
.advanced-grid input:focus { border-color: var(--accent); }
|
|
127
|
+
|
|
128
|
+
/* ---------- 第二步:流程回放 ---------- */
|
|
129
|
+
.pipeline { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 9px; }
|
|
130
|
+
.step {
|
|
131
|
+
display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px;
|
|
132
|
+
border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 16px;
|
|
133
|
+
background: #fbfcfe; opacity: .45; transition: opacity .2s, border-color .2s, background .2s;
|
|
134
|
+
}
|
|
135
|
+
.step.step-active { opacity: 1; border-color: var(--accent); background: #fff; }
|
|
136
|
+
.step.step-done { opacity: 1; border-color: #cfe7db; background: var(--ok-soft); }
|
|
137
|
+
.step.step-warn { opacity: 1; border-color: #ecd9ac; background: var(--warn-soft); }
|
|
138
|
+
.step.step-error { opacity: 1; border-color: #efc4c4; background: var(--err-soft); }
|
|
139
|
+
.step.step-skip { opacity: .7; border-style: dashed; }
|
|
140
|
+
.step-icon {
|
|
141
|
+
width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
|
|
142
|
+
font-size: 17px; background: #fff; border: 1.5px solid var(--line);
|
|
143
|
+
}
|
|
144
|
+
.step-body { min-width: 0; }
|
|
145
|
+
.step-label { font-weight: 600; font-size: 14px; }
|
|
146
|
+
.step-detail { color: var(--ink-soft); font-size: 12.8px; overflow-wrap: anywhere; }
|
|
147
|
+
.step-ms { font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }
|
|
148
|
+
.step-ms b { color: var(--ink); }
|
|
149
|
+
|
|
150
|
+
.error-banner {
|
|
151
|
+
margin-top: 14px; border-left: 4px solid var(--err); background: var(--err-soft);
|
|
152
|
+
border-radius: 8px; padding: 12px 16px; font-size: 13.8px;
|
|
153
|
+
}
|
|
154
|
+
.error-banner b { color: var(--err); }
|
|
155
|
+
.error-banner .hint { display: block; margin-top: 5px; color: var(--ink-soft); }
|
|
156
|
+
.banner-hidden { display: none; }
|
|
157
|
+
|
|
158
|
+
.page-summary { margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
|
|
159
|
+
.summary-hidden { display: none; }
|
|
160
|
+
.summary-item { border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 13px; background: #fbfcfe; }
|
|
161
|
+
.summary-item .k { color: var(--ink-soft); font-size: 12px; }
|
|
162
|
+
.summary-item .v { font-weight: 700; font-size: 14.5px; overflow-wrap: anywhere; }
|
|
163
|
+
.status-badge { display: inline-block; border-radius: 6px; padding: 1px 9px; font-size: 12.5px; font-family: var(--mono); }
|
|
164
|
+
.status-2xx { background: var(--ok-soft); color: var(--ok); }
|
|
165
|
+
.status-3xx { background: var(--accent-soft); color: var(--accent-deep); }
|
|
166
|
+
.status-4xx, .status-5xx { background: var(--err-soft); color: var(--err); }
|
|
167
|
+
.status-0 { background: #eee; color: #777; }
|
|
168
|
+
|
|
169
|
+
/* ---------- 第三步:提取 ---------- */
|
|
170
|
+
.selector-rows { display: grid; gap: 9px; }
|
|
171
|
+
.selector-row { display: grid; grid-template-columns: 180px 1fr 38px; gap: 9px; }
|
|
172
|
+
.selector-row input {
|
|
173
|
+
font-size: 13.8px; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 9px; outline: none;
|
|
174
|
+
}
|
|
175
|
+
.selector-row input:focus { border-color: var(--accent); }
|
|
176
|
+
.selector-row .sel-input { font-family: var(--mono); }
|
|
177
|
+
.selector-row .remove-btn {
|
|
178
|
+
border: 1.5px solid var(--line); background: #fff; border-radius: 9px; cursor: pointer;
|
|
179
|
+
color: var(--ink-soft); font-size: 16px;
|
|
180
|
+
}
|
|
181
|
+
.selector-row .remove-btn:hover { border-color: var(--err); color: var(--err); }
|
|
182
|
+
.extract-actions { display: flex; gap: 10px; margin-top: 12px; }
|
|
183
|
+
.selector-tip { color: var(--ink-soft); font-size: 12.6px; margin: 10px 0 0; }
|
|
184
|
+
|
|
185
|
+
.extract-result { margin-top: 18px; border-top: 1.5px dashed var(--line); padding-top: 16px; }
|
|
186
|
+
.result-hidden { display: none; }
|
|
187
|
+
.result-tabs { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
|
|
188
|
+
.tab {
|
|
189
|
+
border: 1.5px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 15px;
|
|
190
|
+
font-size: 13.5px; cursor: pointer; font-family: inherit; color: var(--ink-soft);
|
|
191
|
+
}
|
|
192
|
+
.tab-active { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-soft); font-weight: 600; }
|
|
193
|
+
.result-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
|
|
194
|
+
|
|
195
|
+
.table-wrap { overflow-x: auto; border: 1.5px solid var(--line); border-radius: 10px; }
|
|
196
|
+
table.data { border-collapse: collapse; width: 100%; font-size: 13.6px; }
|
|
197
|
+
table.data th, table.data td { border-bottom: 1px solid var(--line); padding: 8px 13px; text-align: left; vertical-align: top; }
|
|
198
|
+
table.data th { background: #f6f8fc; font-size: 12.8px; color: var(--ink-soft); position: sticky; top: 0; }
|
|
199
|
+
table.data td { overflow-wrap: anywhere; max-width: 420px; }
|
|
200
|
+
table.data tr:last-child td { border-bottom: none; }
|
|
201
|
+
.json-pane {
|
|
202
|
+
background: #10151d; color: #d7e3f4; border-radius: 10px; padding: 16px;
|
|
203
|
+
font-family: var(--mono); font-size: 12.8px; overflow: auto; max-height: 420px; margin: 0;
|
|
204
|
+
}
|
|
205
|
+
.result-note { color: var(--ink-soft); font-size: 12.6px; margin: 10px 0 0; }
|
|
206
|
+
|
|
207
|
+
.raw-html { margin-top: 16px; font-size: 13.5px; }
|
|
208
|
+
.raw-html summary { cursor: pointer; color: var(--ink-soft); }
|
|
209
|
+
.raw-html-pre {
|
|
210
|
+
background: #10151d; color: #cfe0d0; border-radius: 10px; padding: 14px;
|
|
211
|
+
font-family: var(--mono); font-size: 12px; line-height: 1.5; overflow: auto; max-height: 380px;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* ---------- 历史 ---------- */
|
|
215
|
+
.history-list { display: grid; gap: 8px; }
|
|
216
|
+
.history-item {
|
|
217
|
+
display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px;
|
|
218
|
+
border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 15px; cursor: pointer;
|
|
219
|
+
background: #fbfcfe; transition: border-color .15s; text-align: left; font-family: inherit; font-size: inherit; color: inherit; width: 100%;
|
|
220
|
+
}
|
|
221
|
+
.history-item:hover { border-color: var(--accent); }
|
|
222
|
+
.history-url { font-family: var(--mono); font-size: 12.8px; overflow-wrap: anywhere; color: var(--ink); }
|
|
223
|
+
.history-meta { color: var(--ink-soft); font-size: 12.3px; }
|
|
224
|
+
.history-time { color: var(--ink-soft); font-size: 12px; white-space: nowrap; }
|
|
225
|
+
.history-empty { color: var(--ink-soft); font-size: 13.5px; margin: 0; }
|
|
226
|
+
|
|
227
|
+
/* ---------- 能力说明 ---------- */
|
|
228
|
+
.capability-list { margin: 0; padding-left: 20px; color: var(--ink-soft); font-size: 13.8px; display: grid; gap: 6px; }
|
|
229
|
+
.capability-list b { color: var(--ink); }
|
|
230
|
+
|
|
231
|
+
/* ---------- 页脚 ---------- */
|
|
232
|
+
.site-footer { text-align: center; color: var(--ink-soft); font-size: 12.5px; padding: 18px 0 34px; }
|
|
233
|
+
.site-footer a { color: var(--accent); }
|
|
234
|
+
|
|
235
|
+
@media (max-width: 720px) {
|
|
236
|
+
.topbar { padding: 14px 18px; flex-direction: column; gap: 10px; }
|
|
237
|
+
.crawl-form .url-row { flex-direction: column; }
|
|
238
|
+
.selector-row { grid-template-columns: 1fr; }
|
|
239
|
+
.selector-row .remove-btn { display: none; }
|
|
240
|
+
main { padding: 0 12px; }
|
|
241
|
+
}
|