jike WebMCP
Browser tool configuration for jike
Tools (3)
jike_post()
即刻帖子详情及评论
Parameters
JavaScript Handler
(params) => {
const args = Object.assign({}, params || {});
let data = null;
let __wbContextUrl = globalThis.location?.href || '';
let __wbContextDocument = globalThis.document || null;
const __wbDefault = (value, fallback) => (value === undefined || value === null || value === '' ? fallback : value);
const __wbJoin = (value, separator) => Array.isArray(value) ? value.join(separator) : (value ?? '');
const __wbGet = (value, path) => {
if (!path) return value;
return String(path).split('.').reduce((acc, part) => (acc == null ? undefined : acc[part]), value);
};
const __wbBaseUrl = () => (__wbContextUrl || globalThis.location?.href || '');
const __wbResolve = (target, base) => {
if (target == null) return '';
const text = String(target);
try {
if (/^https?:/i.test(text)) return text;
const resolvedBase = base || __wbBaseUrl();
return resolvedBase ? new URL(text, resolvedBase).toString() : text;
} catch (_error) {
return text;
}
};
const __wbFetch = async (target, options) => {
const url = __wbResolve(target, __wbBaseUrl());
const resp = await globalThis.fetch(url, Object.assign({ credentials: 'include' }, options || {}));
if (!resp.ok) {
throw new Error(`HTTP ${resp.status} for ${url}`);
}
const text = await resp.text();
try {
return { url, text, data: JSON.parse(text) };
} catch (_error) {
return { url, text, data: text };
}
};
return (async () => {
{
const __wbResp = await __wbFetch(`https://m.okjike.com/originalPosts/${args.id}`);
__wbContextUrl = __wbResp.url;
__wbContextDocument = new DOMParser().parseFromString(__wbResp.text, 'text/html');
data = __wbContextDocument;
}
{
const document = __wbContextDocument || globalThis.document;
const location = new URL(__wbBaseUrl());
const window = { document, location };
const fetch = (target, options) => globalThis.fetch(__wbResolve(target, __wbBaseUrl()), Object.assign({ credentials: 'include' }, options || {}));
data = await (((() => {
try {
const el = document.querySelector('script[type="application/json"]');
if (!el) return [];
const data = JSON.parse(el.textContent);
const pageProps = data?.props?.pageProps || {};
const post = pageProps.post || {};
const comments = pageProps.comments || [];
const result = [{
type: 'post',
author: post.user?.screenName || '',
content: post.content || '',
likes: post.likeCount || 0,
time: post.createdAt || '',
}];
for (const c of comments) {
result.push({
type: 'comment',
author: c.user?.screenName || '',
content: (c.content || '').replace(/\n/g, ' '),
likes: c.likeCount || 0,
time: c.createdAt || '',
});
}
return result;
} catch (e) {
return [];
}
})())());
}
{
const source = Array.isArray(data) ? data : (data == null ? [] : [data]);
data = source.map((item, index) => ({
"type": item.type,
"author": item.author,
"content": item.content,
"likes": item.likes,
"time": item.time,
}));
}
return data;
})();
}
jike_topic()
即刻话题/圈子帖子
Parameters
JavaScript Handler
(params) => {
const args = Object.assign({"limit": 20}, params || {});
let data = null;
let __wbContextUrl = globalThis.location?.href || '';
let __wbContextDocument = globalThis.document || null;
const __wbDefault = (value, fallback) => (value === undefined || value === null || value === '' ? fallback : value);
const __wbJoin = (value, separator) => Array.isArray(value) ? value.join(separator) : (value ?? '');
const __wbGet = (value, path) => {
if (!path) return value;
return String(path).split('.').reduce((acc, part) => (acc == null ? undefined : acc[part]), value);
};
const __wbBaseUrl = () => (__wbContextUrl || globalThis.location?.href || '');
const __wbResolve = (target, base) => {
if (target == null) return '';
const text = String(target);
try {
if (/^https?:/i.test(text)) return text;
const resolvedBase = base || __wbBaseUrl();
return resolvedBase ? new URL(text, resolvedBase).toString() : text;
} catch (_error) {
return text;
}
};
const __wbFetch = async (target, options) => {
const url = __wbResolve(target, __wbBaseUrl());
const resp = await globalThis.fetch(url, Object.assign({ credentials: 'include' }, options || {}));
if (!resp.ok) {
throw new Error(`HTTP ${resp.status} for ${url}`);
}
const text = await resp.text();
try {
return { url, text, data: JSON.parse(text) };
} catch (_error) {
return { url, text, data: text };
}
};
return (async () => {
{
const __wbResp = await __wbFetch(`https://m.okjike.com/topics/${args.id}`);
__wbContextUrl = __wbResp.url;
__wbContextDocument = new DOMParser().parseFromString(__wbResp.text, 'text/html');
data = __wbContextDocument;
}
{
const document = __wbContextDocument || globalThis.document;
const location = new URL(__wbBaseUrl());
const window = { document, location };
const fetch = (target, options) => globalThis.fetch(__wbResolve(target, __wbBaseUrl()), Object.assign({ credentials: 'include' }, options || {}));
data = await (((() => {
try {
const el = document.querySelector('script[type="application/json"]');
if (!el) return [];
const data = JSON.parse(el.textContent);
const pageProps = data?.props?.pageProps || {};
const posts = pageProps.posts || [];
return posts.map(p => ({
content: (p.content || '').replace(/\n/g, ' ').slice(0, 80),
author: p.user?.screenName || '',
likes: p.likeCount || 0,
comments: p.commentCount || 0,
time: p.actionTime || p.createdAt || '',
id: p.id || '',
}));
} catch (e) {
return [];
}
})())());
}
{
const source = Array.isArray(data) ? data : (data == null ? [] : [data]);
data = source.map((item, index) => ({
"content": item.content,
"author": item.author,
"likes": item.likes,
"comments": item.comments,
"time": item.time,
"url": `https://web.okjike.com/originalPost/${item.id}`,
}));
}
if (Array.isArray(data)) data = data.slice(0, Number(args.limit) || 0);
return data;
})();
}
jike_user()
即刻用户动态
Parameters
JavaScript Handler
(params) => {
const args = Object.assign({"limit": 20}, params || {});
let data = null;
let __wbContextUrl = globalThis.location?.href || '';
let __wbContextDocument = globalThis.document || null;
const __wbDefault = (value, fallback) => (value === undefined || value === null || value === '' ? fallback : value);
const __wbJoin = (value, separator) => Array.isArray(value) ? value.join(separator) : (value ?? '');
const __wbGet = (value, path) => {
if (!path) return value;
return String(path).split('.').reduce((acc, part) => (acc == null ? undefined : acc[part]), value);
};
const __wbBaseUrl = () => (__wbContextUrl || globalThis.location?.href || '');
const __wbResolve = (target, base) => {
if (target == null) return '';
const text = String(target);
try {
if (/^https?:/i.test(text)) return text;
const resolvedBase = base || __wbBaseUrl();
return resolvedBase ? new URL(text, resolvedBase).toString() : text;
} catch (_error) {
return text;
}
};
const __wbFetch = async (target, options) => {
const url = __wbResolve(target, __wbBaseUrl());
const resp = await globalThis.fetch(url, Object.assign({ credentials: 'include' }, options || {}));
if (!resp.ok) {
throw new Error(`HTTP ${resp.status} for ${url}`);
}
const text = await resp.text();
try {
return { url, text, data: JSON.parse(text) };
} catch (_error) {
return { url, text, data: text };
}
};
return (async () => {
{
const __wbResp = await __wbFetch(`https://m.okjike.com/users/${args.username}`);
__wbContextUrl = __wbResp.url;
__wbContextDocument = new DOMParser().parseFromString(__wbResp.text, 'text/html');
data = __wbContextDocument;
}
{
const document = __wbContextDocument || globalThis.document;
const location = new URL(__wbBaseUrl());
const window = { document, location };
const fetch = (target, options) => globalThis.fetch(__wbResolve(target, __wbBaseUrl()), Object.assign({ credentials: 'include' }, options || {}));
data = await (((() => {
try {
const el = document.querySelector('script[type="application/json"]');
if (!el) return [];
const data = JSON.parse(el.textContent);
const posts = data?.props?.pageProps?.posts || [];
return posts.map(p => ({
content: (p.content || '').replace(/\n/g, ' ').slice(0, 80),
type: p.type === 'ORIGINAL_POST' ? 'post' : p.type === 'REPOST' ? 'repost' : p.type || '',
likes: p.likeCount || 0,
comments: p.commentCount || 0,
time: p.actionTime || p.createdAt || '',
id: p.id || '',
}));
} catch (e) {
return [];
}
})())());
}
{
const source = Array.isArray(data) ? data : (data == null ? [] : [data]);
data = source.map((item, index) => ({
"content": item.content,
"type": item.type,
"likes": item.likes,
"comments": item.comments,
"time": item.time,
"url": `https://web.okjike.com/originalPost/${item.id}`,
}));
}
if (Array.isArray(data)) data = data.slice(0, Number(args.limit) || 0);
return data;
})();
}
🔌 Chrome MCP Server Extension
Use these tools with Claude, ChatGPT, and other AI assistants.
How to Use WebMCP
WebMCP tools are designed for browser extensions or automation frameworks. The browser extension matches the current URL against the pattern and executes the JavaScript handler when the tool is invoked.
API Endpoint:
GET /api/webmcp/match?url=https://www.jike.com/...