add TikTok Cookie Chrome helper and Tampermonkey script
Avoid F12 cookie copy: read HttpOnly sessionid, fill dylive paste form. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
19bb3ba134
commit
d0bbcb484a
26
extensions/tiktok-cookie-helper/README.md
Normal file
26
extensions/tiktok-cookie-helper/README.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# dylive TikTok Cookie 助手
|
||||||
|
|
||||||
|
TikTok 的 `sessionid` 一般是 **HttpOnly**,页面 JS / 普通油猴读不到。
|
||||||
|
**推荐 Chrome 插件**(`chrome.cookies` 可读 HttpOnly)。油猴脚本需要 Tampermonkey 的 `GM.cookie`。
|
||||||
|
|
||||||
|
## Chrome 插件(推荐)
|
||||||
|
|
||||||
|
1. 打开 `chrome://extensions`
|
||||||
|
2. 打开右上角「开发者模式」
|
||||||
|
3. 「加载已解压的扩展程序」→ 选本目录 `extensions/tiktok-cookie-helper`
|
||||||
|
4. 浏览器登录 [tiktok.com](https://www.tiktok.com)
|
||||||
|
5. 点工具栏图标 → **复制 JSON** 或 **填入控制台**
|
||||||
|
6. 到 [dylive /tiktok](https://dylive.nomadro.com/tiktok) 打开「粘贴 Cookie」,点保存
|
||||||
|
|
||||||
|
## 油猴脚本
|
||||||
|
|
||||||
|
1. 安装 Tampermonkey
|
||||||
|
2. 导入 `tiktok-cookie.user.js`
|
||||||
|
3. 打开并登录 tiktok.com,点右下角「导出 Cookie → dylive」
|
||||||
|
4. 回到控制台「从剪贴板导入」
|
||||||
|
|
||||||
|
若提示不支持 `GM.cookie`,改用 Chrome 插件。
|
||||||
|
|
||||||
|
## 安全
|
||||||
|
|
||||||
|
`sessionid` 等同账号密码。不要发给别人,不要贴到聊天软件。
|
||||||
46
extensions/tiktok-cookie-helper/background.js
Normal file
46
extensions/tiktok-cookie-helper/background.js
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
const TIKTOK_URLS = [
|
||||||
|
"https://www.tiktok.com/",
|
||||||
|
"https://www.tiktok.com",
|
||||||
|
];
|
||||||
|
|
||||||
|
function cookieMap(cookies) {
|
||||||
|
const out = {};
|
||||||
|
for (const c of cookies || []) {
|
||||||
|
if (c && c.name) out[c.name] = c.value || "";
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function readTikTokCookies() {
|
||||||
|
const bags = await Promise.all(
|
||||||
|
TIKTOK_URLS.map((url) => chrome.cookies.getAll({ url }).catch(() => [])),
|
||||||
|
);
|
||||||
|
const byName = cookieMap(bags.flat());
|
||||||
|
const extra = await chrome.cookies.getAll({ domain: ".tiktok.com" }).catch(() => []);
|
||||||
|
Object.assign(byName, cookieMap(extra));
|
||||||
|
|
||||||
|
const sessionid = String(byName.sessionid || byName.sessionid_ss || "").trim();
|
||||||
|
const dc = String(byName["tt-target-idc"] || byName.tt_target_idc || "").trim() || "useast2a";
|
||||||
|
const username = String(byName["uniqueid"] || byName.uniqueId || "").trim();
|
||||||
|
return {
|
||||||
|
ok: Boolean(sessionid),
|
||||||
|
sessionid,
|
||||||
|
dc_id: dc,
|
||||||
|
tiktok_username: username,
|
||||||
|
payload: {
|
||||||
|
sessionid,
|
||||||
|
dc_id: dc,
|
||||||
|
tiktok_username: username,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
chrome.runtime.onMessage.addListener((msg, _sender, sendResponse) => {
|
||||||
|
if (msg?.type === "GET_TIKTOK_COOKIES") {
|
||||||
|
readTikTokCookies()
|
||||||
|
.then(sendResponse)
|
||||||
|
.catch((err) => sendResponse({ ok: false, error: String(err) }));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
34
extensions/tiktok-cookie-helper/content-dylive.js
Normal file
34
extensions/tiktok-cookie-helper/content-dylive.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
function fillCookieForm(payload) {
|
||||||
|
const sid = document.getElementById("tiktok-sessionid");
|
||||||
|
const dc = document.getElementById("tiktok-dc-id");
|
||||||
|
const user = document.getElementById("tiktok-username");
|
||||||
|
if (!sid || !dc) {
|
||||||
|
window.dispatchEvent(new CustomEvent("dylive-tiktok-cookie", { detail: payload }));
|
||||||
|
return { ok: false, reason: "form-hidden" };
|
||||||
|
}
|
||||||
|
const setNative = (el, value) => {
|
||||||
|
const proto = Object.getPrototypeOf(el);
|
||||||
|
const desc = Object.getOwnPropertyDescriptor(proto, "value");
|
||||||
|
desc?.set?.call(el, value);
|
||||||
|
el.dispatchEvent(new Event("input", { bubbles: true }));
|
||||||
|
el.dispatchEvent(new Event("change", { bubbles: true }));
|
||||||
|
};
|
||||||
|
setNative(sid, payload.sessionid || "");
|
||||||
|
setNative(dc, payload.dc_id || "useast2a");
|
||||||
|
if (user && payload.tiktok_username) setNative(user, payload.tiktok_username);
|
||||||
|
return { ok: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
chrome.runtime.onMessage.addListener((msg, _sender, sendResponse) => {
|
||||||
|
if (msg?.type !== "DYLIVE_FILL_TIKTOK_COOKIE") return;
|
||||||
|
sendResponse(fillCookieForm(msg.payload || {}));
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener("dylive-tiktok-cookie-request", async () => {
|
||||||
|
try {
|
||||||
|
const data = await chrome.runtime.sendMessage({ type: "GET_TIKTOK_COOKIES" });
|
||||||
|
if (data?.ok) window.dispatchEvent(new CustomEvent("dylive-tiktok-cookie", { detail: data.payload }));
|
||||||
|
} catch {
|
||||||
|
/* popup / page 未授权时忽略 */
|
||||||
|
}
|
||||||
|
});
|
||||||
BIN
extensions/tiktok-cookie-helper/icon.png
Normal file
BIN
extensions/tiktok-cookie-helper/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 805 KiB |
36
extensions/tiktok-cookie-helper/manifest.json
Normal file
36
extensions/tiktok-cookie-helper/manifest.json
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"manifest_version": 3,
|
||||||
|
"name": "dylive TikTok Cookie",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "从已登录的 tiktok.com 读取 sessionid / tt-target-idc,一键复制或填入 dylive 控制台。",
|
||||||
|
"icons": {
|
||||||
|
"128": "icon.png"
|
||||||
|
},
|
||||||
|
"action": {
|
||||||
|
"default_title": "导出 TikTok Cookie",
|
||||||
|
"default_popup": "popup.html",
|
||||||
|
"default_icon": "icon.png"
|
||||||
|
},
|
||||||
|
"permissions": ["cookies", "tabs", "clipboardWrite", "scripting"],
|
||||||
|
"host_permissions": [
|
||||||
|
"https://www.tiktok.com/*",
|
||||||
|
"https://*.tiktok.com/*",
|
||||||
|
"https://dylive.nomadro.com/*",
|
||||||
|
"http://127.0.0.1/*",
|
||||||
|
"http://localhost/*"
|
||||||
|
],
|
||||||
|
"background": {
|
||||||
|
"service_worker": "background.js"
|
||||||
|
},
|
||||||
|
"content_scripts": [
|
||||||
|
{
|
||||||
|
"matches": [
|
||||||
|
"https://dylive.nomadro.com/tiktok*",
|
||||||
|
"http://127.0.0.1:*/tiktok*",
|
||||||
|
"http://localhost:*/tiktok*"
|
||||||
|
],
|
||||||
|
"js": ["content-dylive.js"],
|
||||||
|
"run_at": "document_idle"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
66
extensions/tiktok-cookie-helper/popup.css
Normal file
66
extensions/tiktok-cookie-helper/popup.css
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
:root {
|
||||||
|
color-scheme: dark;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
width: 320px;
|
||||||
|
font: 13px/1.45 system-ui, sans-serif;
|
||||||
|
background: #0f1419;
|
||||||
|
color: #e8eef5;
|
||||||
|
}
|
||||||
|
header {
|
||||||
|
padding: 12px 14px 8px;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
header p {
|
||||||
|
margin: 4px 0 0;
|
||||||
|
color: #8b98a8;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
.status {
|
||||||
|
margin: 0 14px 10px;
|
||||||
|
padding: 8px 10px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
.status.idle { background: #1c2430; color: #9aa8b8; }
|
||||||
|
.status.ok { background: #113228; color: #7ee0a8; }
|
||||||
|
.status.err { background: #3a1518; color: #ff9aa3; }
|
||||||
|
dl {
|
||||||
|
margin: 0 14px 12px;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 110px 1fr;
|
||||||
|
gap: 6px 8px;
|
||||||
|
}
|
||||||
|
dt { color: #8b98a8; }
|
||||||
|
dd {
|
||||||
|
margin: 0;
|
||||||
|
font-family: ui-monospace, Consolas, monospace;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
.actions {
|
||||||
|
display: grid;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 0 14px 8px;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
border: 0;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 8px 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
background: #ff2d55;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
button:disabled { opacity: 0.45; cursor: not-allowed; }
|
||||||
|
button#fill, button#open-dy { background: #2a3340; }
|
||||||
|
button#open-tt { background: #1c2430; color: #d7e0ea; }
|
||||||
|
.hint {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 14px 14px;
|
||||||
|
color: #8b98a8;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
29
extensions/tiktok-cookie-helper/popup.html
Normal file
29
extensions/tiktok-cookie-helper/popup.html
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>dylive TikTok Cookie</title>
|
||||||
|
<link rel="stylesheet" href="popup.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<h1>TikTok Cookie</h1>
|
||||||
|
<p>登录 tiktok.com 后点导出,无需 F12</p>
|
||||||
|
</header>
|
||||||
|
<div id="status" class="status idle">正在读取…</div>
|
||||||
|
<dl>
|
||||||
|
<dt>sessionid</dt>
|
||||||
|
<dd id="sid">—</dd>
|
||||||
|
<dt>tt-target-idc</dt>
|
||||||
|
<dd id="dc">—</dd>
|
||||||
|
</dl>
|
||||||
|
<div class="actions">
|
||||||
|
<button id="copy" type="button" disabled>复制 JSON</button>
|
||||||
|
<button id="fill" type="button" disabled>填入控制台</button>
|
||||||
|
<button id="open-tt" type="button">打开 TikTok 登录</button>
|
||||||
|
<button id="open-dy" type="button">打开 dylive /tiktok</button>
|
||||||
|
</div>
|
||||||
|
<p class="hint">sessionid 等同密码,只粘贴到自己的 dylive 控制台。</p>
|
||||||
|
<script src="popup.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
64
extensions/tiktok-cookie-helper/popup.js
Normal file
64
extensions/tiktok-cookie-helper/popup.js
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
const CONSOLE_URL = "https://dylive.nomadro.com/tiktok";
|
||||||
|
let lastPayload = null;
|
||||||
|
|
||||||
|
function mask(v) {
|
||||||
|
const s = String(v || "");
|
||||||
|
if (s.length <= 8) return s ? "***" : "—";
|
||||||
|
return `${s.slice(0, 4)}…${s.slice(-4)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setStatus(kind, text) {
|
||||||
|
const el = document.getElementById("status");
|
||||||
|
el.className = `status ${kind}`;
|
||||||
|
el.textContent = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadCookies() {
|
||||||
|
const data = await chrome.runtime.sendMessage({ type: "GET_TIKTOK_COOKIES" });
|
||||||
|
lastPayload = data?.ok ? data.payload : null;
|
||||||
|
document.getElementById("sid").textContent = data?.ok ? mask(data.sessionid) : "未登录 / 未找到";
|
||||||
|
document.getElementById("dc").textContent = data?.dc_id || "useast2a";
|
||||||
|
document.getElementById("copy").disabled = !data?.ok;
|
||||||
|
document.getElementById("fill").disabled = !data?.ok;
|
||||||
|
if (data?.ok) setStatus("ok", "已读到 Cookie,可复制或填入控制台");
|
||||||
|
else setStatus("err", data?.error || "请先在本浏览器登录 tiktok.com,再点插件");
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById("copy").addEventListener("click", async () => {
|
||||||
|
if (!lastPayload) return;
|
||||||
|
await navigator.clipboard.writeText(JSON.stringify(lastPayload));
|
||||||
|
setStatus("ok", "已复制 JSON,到控制台点「从剪贴板导入」");
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById("fill").addEventListener("click", async () => {
|
||||||
|
if (!lastPayload) return;
|
||||||
|
const tabs = await chrome.tabs.query({});
|
||||||
|
const target = tabs.find((t) => /\/tiktok(\?|$)/.test(t.url || "") && /dylive\.nomadro\.com|127\.0\.0\.1|localhost/.test(t.url || ""));
|
||||||
|
if (!target?.id) {
|
||||||
|
await chrome.tabs.create({ url: CONSOLE_URL });
|
||||||
|
setStatus("idle", "已打开控制台。打开「粘贴 Cookie」后再点一次「填入控制台」");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await chrome.tabs.update(target.id, { active: true });
|
||||||
|
try {
|
||||||
|
await chrome.tabs.sendMessage(target.id, { type: "DYLIVE_FILL_TIKTOK_COOKIE", payload: lastPayload });
|
||||||
|
setStatus("ok", "已填入控制台表单,确认后点保存");
|
||||||
|
} catch {
|
||||||
|
await chrome.scripting.executeScript({
|
||||||
|
target: { tabId: target.id },
|
||||||
|
files: ["content-dylive.js"],
|
||||||
|
});
|
||||||
|
await chrome.tabs.sendMessage(target.id, { type: "DYLIVE_FILL_TIKTOK_COOKIE", payload: lastPayload });
|
||||||
|
setStatus("ok", "已填入控制台表单,确认后点保存");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById("open-tt").addEventListener("click", () => {
|
||||||
|
chrome.tabs.create({ url: "https://www.tiktok.com/login" });
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById("open-dy").addEventListener("click", () => {
|
||||||
|
chrome.tabs.create({ url: CONSOLE_URL });
|
||||||
|
});
|
||||||
|
|
||||||
|
void loadCookies();
|
||||||
74
extensions/tiktok-cookie-helper/tiktok-cookie.user.js
Normal file
74
extensions/tiktok-cookie-helper/tiktok-cookie.user.js
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @name dylive TikTok Cookie 导出
|
||||||
|
// @namespace https://dylive.nomadro.com
|
||||||
|
// @version 1.0.0
|
||||||
|
// @description 在已登录的 tiktok.com 一键复制 sessionid / tt-target-idc(需 GM.cookie,可读取 HttpOnly)
|
||||||
|
// @match https://www.tiktok.com/*
|
||||||
|
// @match https://*.tiktok.com/*
|
||||||
|
// @grant GM.cookie
|
||||||
|
// @grant GM.setClipboard
|
||||||
|
// @grant GM_setClipboard
|
||||||
|
// @run-at document-idle
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function mask(v) {
|
||||||
|
const s = String(v || "");
|
||||||
|
if (s.length <= 8) return s ? "***" : "无";
|
||||||
|
return s.slice(0, 4) + "…" + s.slice(-4);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function readCookies() {
|
||||||
|
if (!GM?.cookie?.list) {
|
||||||
|
throw new Error("当前油猴不支持 GM.cookie。请改用 Chrome 插件(能读 HttpOnly sessionid)。");
|
||||||
|
}
|
||||||
|
const list = await GM.cookie.list({ url: location.origin + "/" });
|
||||||
|
const map = Object.fromEntries((list || []).map((c) => [c.name, c.value]));
|
||||||
|
const sessionid = String(map.sessionid || map.sessionid_ss || "").trim();
|
||||||
|
const dc_id = String(map["tt-target-idc"] || "").trim() || "useast2a";
|
||||||
|
if (!sessionid) throw new Error("未找到 sessionid,请先登录 TikTok");
|
||||||
|
return { sessionid, dc_id, tiktok_username: "" };
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copyJson(payload) {
|
||||||
|
const text = JSON.stringify(payload);
|
||||||
|
if (typeof GM_setClipboard === "function") GM_setClipboard(text);
|
||||||
|
else if (GM?.setClipboard) await GM.setClipboard(text);
|
||||||
|
else await navigator.clipboard.writeText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
const btn = document.createElement("button");
|
||||||
|
btn.textContent = "导出 Cookie → dylive";
|
||||||
|
btn.style.cssText = [
|
||||||
|
"position:fixed",
|
||||||
|
"right:16px",
|
||||||
|
"bottom:16px",
|
||||||
|
"z-index:2147483647",
|
||||||
|
"padding:10px 14px",
|
||||||
|
"border:0",
|
||||||
|
"border-radius:999px",
|
||||||
|
"background:#fe2c55",
|
||||||
|
"color:#fff",
|
||||||
|
"font:600 13px/1 system-ui,sans-serif",
|
||||||
|
"cursor:pointer",
|
||||||
|
"box-shadow:0 8px 24px rgba(0,0,0,.35)",
|
||||||
|
].join(";");
|
||||||
|
btn.addEventListener("click", async () => {
|
||||||
|
try {
|
||||||
|
const payload = await readCookies();
|
||||||
|
await copyJson(payload);
|
||||||
|
btn.textContent = "已复制 " + mask(payload.sessionid);
|
||||||
|
setTimeout(() => {
|
||||||
|
btn.textContent = "导出 Cookie → dylive";
|
||||||
|
}, 2500);
|
||||||
|
} catch (err) {
|
||||||
|
btn.textContent = String(err.message || err);
|
||||||
|
setTimeout(() => {
|
||||||
|
btn.textContent = "导出 Cookie → dylive";
|
||||||
|
}, 4000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
document.documentElement.appendChild(btn);
|
||||||
|
})();
|
||||||
@ -159,6 +159,45 @@ export default function TikTokPage() {
|
|||||||
void load();
|
void load();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const applyCookiePayload = (raw: unknown) => {
|
||||||
|
const data = typeof raw === "string" ? JSON.parse(raw) : raw;
|
||||||
|
const sessionid = String((data as any)?.sessionid || "").trim();
|
||||||
|
const dc_id = String((data as any)?.dc_id || (data as any)?.["tt-target-idc"] || "").trim();
|
||||||
|
const username = String((data as any)?.tiktok_username || "").trim();
|
||||||
|
if (!sessionid) throw new Error("剪贴板里没有 sessionid");
|
||||||
|
setSessionId(sessionid);
|
||||||
|
setSessionDcId(dc_id || "useast2a");
|
||||||
|
if (username) setSessionUsername(username);
|
||||||
|
};
|
||||||
|
|
||||||
|
const importFromClipboard = async () => {
|
||||||
|
try {
|
||||||
|
const text = await navigator.clipboard.readText();
|
||||||
|
applyCookiePayload(text);
|
||||||
|
toast.push("已从剪贴板填入 Cookie", "ok");
|
||||||
|
} catch (e: any) {
|
||||||
|
toast.push(e?.message || "读取剪贴板失败", "err");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const importFromExtension = () => {
|
||||||
|
window.dispatchEvent(new Event("dylive-tiktok-cookie-request"));
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const onFill = (ev: Event) => {
|
||||||
|
const detail = (ev as CustomEvent).detail;
|
||||||
|
try {
|
||||||
|
applyCookiePayload(detail);
|
||||||
|
toast.push("已从插件填入 Cookie", "ok");
|
||||||
|
} catch (e: any) {
|
||||||
|
toast.push(e?.message || "插件数据无效", "err");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
window.addEventListener("dylive-tiktok-cookie", onFill as EventListener);
|
||||||
|
return () => window.removeEventListener("dylive-tiktok-cookie", onFill as EventListener);
|
||||||
|
}, [toast]);
|
||||||
|
|
||||||
const saveSession = async () => {
|
const saveSession = async () => {
|
||||||
if (!sessionChannelId) {
|
if (!sessionChannelId) {
|
||||||
toast.push("请选择账号", "err");
|
toast.push("请选择账号", "err");
|
||||||
@ -506,15 +545,29 @@ export default function TikTokPage() {
|
|||||||
<section className="mb-6 rounded-2xl border border-pink-500/30 bg-black/30 p-4">
|
<section className="mb-6 rounded-2xl border border-pink-500/30 bg-black/30 p-4">
|
||||||
<h3 className="mb-2 text-sm font-medium text-slate-100">粘贴 TikTok Cookie</h3>
|
<h3 className="mb-2 text-sm font-medium text-slate-100">粘贴 TikTok Cookie</h3>
|
||||||
<p className="mb-3 text-xs leading-relaxed text-slate-500">
|
<p className="mb-3 text-xs leading-relaxed text-slate-500">
|
||||||
在浏览器登录 tiktok.com → F12 → Application → Cookies → 复制{" "}
|
推荐用 Chrome 插件或油猴导出 Cookie(无需 F12)。sessionid 等同密码,请勿泄露。
|
||||||
<code className="text-pink-300">sessionid</code> 和{" "}
|
|
||||||
<code className="text-pink-300">tt-target-idc</code>(后者默认 useast2a)。
|
|
||||||
sessionid 等同密码,请勿泄露。
|
|
||||||
</p>
|
</p>
|
||||||
|
<div className="mb-3 flex flex-wrap gap-2">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => void importFromClipboard()}
|
||||||
|
className="rounded-lg border border-pink-500/30 bg-pink-500/10 px-3 py-1.5 text-xs text-pink-200"
|
||||||
|
>
|
||||||
|
从剪贴板导入
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={importFromExtension}
|
||||||
|
className="rounded-lg border border-white/10 bg-white/5 px-3 py-1.5 text-xs text-slate-200"
|
||||||
|
>
|
||||||
|
从插件读取
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<div className="grid gap-3 sm:grid-cols-2">
|
<div className="grid gap-3 sm:grid-cols-2">
|
||||||
<label className="text-xs text-slate-400 sm:col-span-2">
|
<label className="text-xs text-slate-400 sm:col-span-2">
|
||||||
sessionid
|
sessionid
|
||||||
<input
|
<input
|
||||||
|
id="tiktok-sessionid"
|
||||||
type="password"
|
type="password"
|
||||||
value={sessionId}
|
value={sessionId}
|
||||||
onChange={(e) => setSessionId(e.target.value)}
|
onChange={(e) => setSessionId(e.target.value)}
|
||||||
@ -525,6 +578,7 @@ export default function TikTokPage() {
|
|||||||
<label className="text-xs text-slate-400">
|
<label className="text-xs text-slate-400">
|
||||||
tt-target-idc
|
tt-target-idc
|
||||||
<input
|
<input
|
||||||
|
id="tiktok-dc-id"
|
||||||
value={sessionDcId}
|
value={sessionDcId}
|
||||||
onChange={(e) => setSessionDcId(e.target.value)}
|
onChange={(e) => setSessionDcId(e.target.value)}
|
||||||
placeholder="useast2a"
|
placeholder="useast2a"
|
||||||
@ -534,6 +588,7 @@ export default function TikTokPage() {
|
|||||||
<label className="text-xs text-slate-400">
|
<label className="text-xs text-slate-400">
|
||||||
TikTok 用户名(可选)
|
TikTok 用户名(可选)
|
||||||
<input
|
<input
|
||||||
|
id="tiktok-username"
|
||||||
value={sessionUsername}
|
value={sessionUsername}
|
||||||
onChange={(e) => setSessionUsername(e.target.value)}
|
onChange={(e) => setSessionUsername(e.target.value)}
|
||||||
placeholder="@handle"
|
placeholder="@handle"
|
||||||
@ -778,14 +833,17 @@ export default function TikTokPage() {
|
|||||||
</div>
|
</div>
|
||||||
<ol className="list-inside list-decimal space-y-1">
|
<ol className="list-inside list-decimal space-y-1">
|
||||||
<li>
|
<li>
|
||||||
浏览器打开{" "}
|
加载 Chrome 插件:<code className="text-pink-300">extensions/tiktok-cookie-helper</code>
|
||||||
|
(chrome://extensions → 开发者模式 → 加载已解压)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
登录{" "}
|
||||||
<a href="https://www.tiktok.com" target="_blank" rel="noreferrer" className="text-pink-300 hover:underline">
|
<a href="https://www.tiktok.com" target="_blank" rel="noreferrer" className="text-pink-300 hover:underline">
|
||||||
tiktok.com
|
tiktok.com
|
||||||
</a>{" "}
|
</a>
|
||||||
并登录
|
,点插件「复制 JSON」或「填入控制台」
|
||||||
</li>
|
</li>
|
||||||
<li>F12 → Application → Cookies → 复制 sessionid</li>
|
<li>本页打开「粘贴 Cookie」→「从剪贴板导入」→ 保存</li>
|
||||||
<li>在账号卡片上点「粘贴 Cookie」保存</li>
|
|
||||||
</ol>
|
</ol>
|
||||||
</section>
|
</section>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user