popclip插件合集

前言:给出代码的选中自动识别安装,需要下载安装的请前往相关地址安装
一、Blinko笔记
自制的,代码如下:
// #popclip extension for Send to Blinko
// name: Blinko笔记
// icon: square filled BK
// language: javascript
// module: true
// entitlements: [network]
// options: [{
// identifier: "siteUrl",
// label: "服务端地址",
// type: "string",
// defaultValue: "https://note.noisework.cn",
// description: "请确保地址正确,不要带末尾斜杠"
// }, {
// identifier: "token",
// label: "API Token",
// type: "string",
// description: "从设置页面获取最新Token"
// }]
async function sendToShuo(input, options) {
try {
// 参数预处理
const siteUrl = (options.siteUrl || "").replace(/\/+$/g, "");
const token = (options.token || "").trim();
const content = (input.text || "").trim();
// 验证参数
if (!/^https:\/\/[\w.-]+(:\d+)?$/.test(siteUrl)) {
throw new Error("地址格式错误,示例: https://note.noisework.cn");
}
if (!token) throw new Error("Token不能为空");
if (!content) throw new Error("选中文本不能为空");
// 发送请求
await sendRequestWithXMLHttpRequest(siteUrl, token, content);
PopClip.showText("✓ 发送成功");
} catch (error) {
handleRequestError(error);
}
}
// 使用 XMLHttpRequest 实现网络请求
function sendRequestWithXMLHttpRequest(siteUrl, token, content) {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
const url = `${siteUrl}/api/v1/note/upsert`;
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Authorization", `Bearer ${token}`);
xhr.timeout = 10000; // 设置超时时间(10秒)
// 设置回调函数
xhr.onreadystatechange = () => {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status >= 200 && xhr.status < 300) {
resolve(xhr.responseText);
} else {
let errorMsg = `请求失败 (${xhr.status})`;
try {
const data = JSON.parse(xhr.responseText);
errorMsg = data.message || errorMsg;
} catch {}
reject(new Error(errorMsg));
}
}
};
// 处理网络错误
xhr.onerror = () => reject(new Error("网络错误"));
// 处理超时错误
xhr.ontimeout = () => reject(new Error("请求超时"));
try {
// 发送请求
const payload = JSON.stringify({
content: `#Popclip\n${content}`, // 内容字段
type: 0, // 类型,固定为 0
attachments: [], // 附件,空数组
isArchived: null, // 是否归档
isTop: null, // 是否置顶
isShare: null, // 是否分享
isRecycle: null, // 是否放入回收站
references: [null] // 参考内容
});
xhr.send(payload);
} catch (error) {
reject(new Error("请求发送失败: " + error.message));
}
});
}
// 错误处理
function handleRequestError(error) {
console.error("请求错误:", error);
const errorMap = {
"Failed to fetch": "无法连接到服务器",
"aborted": "请求超时",
"网络错误": "网络错误",
"401": "认证失败,请检查Token",
"404": "API地址不存在"
};
const message = Object.entries(errorMap).find(([key]) =>
error.message.includes(key)
)?.[1] || `请求错误: ${error.message.split('\n')[0].slice(0, 50)}`;
PopClip.showText(`❌ ${message}`);
}
exports.actions = [{
title: "发送至Blinko",
code: sendToShuo,
icon: "square filled BK"
}];
二、多模式AI写手
// #popclip extension for ChatGPT
// name: smart writer
// icon: iconify:fluent:calligraphy-pen-24-regular
// language: javascript
// module: true
// entitlements: [network]
// options: [{
// identifier: apikey, label: API Key, type: string,
// description: 'Obtain API key from https://platform.openai.com/account/api-keys'
// }]
const prefixes = {
"polish": "你是我的写作助手,检查接收到的文字的拼写、语法错误,对其进行润色:\n",
"xiaohongshu": "扮演文本助理,使用小红书的 Emoji 风格润色我的内容,特点是每行开头都是一个相关表情符号,达到引人入胜的目的:\n",
"Summarize": "归纳总结这些文字,同时用列表列出要点:\n",
"translate": "将发送的文字内容都翻译成中文,如果内容是中文则翻译成标准的英文:\n",
"Official": "你将扮演专业的微信公众号运营者,优化润色我给的内容成为爆款标题:\n",
}
async function chat (input, options, lang, prefixName) {
const openai = require("axios").create({
baseURL: "https://www.noiseapi.top/v1",
headers: { Authorization: `Bearer ${options.apikey}` },
});
let messages
switch (lang) {
case "en":
messages = [
{"role": "system", "content": "I want you act as a proofreader. I will provide you texts and I would like you to review them for any spelling, grammar, or punctuation errors."},
{"role": "user", "content": `Proofread the following content and give me the result without extra delarations or comments:\n\n${input.text}`},
]
break;
case "zh":
messages = [
{"role": "system", "content": "你是我的写作助手,检查接收到的文字的拼写、语法错误,向我提供修改后的文字。"},
{"role": "user", "content": `修改下面的文字,直接输出修改后的结果,不需要额外的声明:\n${input.text}`}
]
break;
}
if (prefixName) {
messages = [{"role": "user", "content": `${prefixes[prefixName]}${input.text}`}]
}
const { data } = await openai.post("/chat/completions", {
model: "free-gpt-4o-2024-08-06",
messages,
});
const result = data.choices[0].message;
return input.text.trimEnd() + "\n\n" + result.content.trim();
};
exports.actions = [
{
title: "公众号爆款标题",
icon: "circle 标题",
after: "paste-result",
code: async (input, options) => chat(input, options, "", "Official"),
},
{
title: "小红书风格",
icon: "circle 红书",
after: "paste-result",
code: async (input, options) => chat(input, options, "", "xiaohongshu"),
},
{
title: "总结内容",
icon: "circle 总结",
after: "paste-result",
code: async (input, options) => chat(input, options, "", "Summarize"),
},
{
title: "中英互译",
icon: "square 翻译",
after: "paste-result",
code: async (input, options) => chat(input, options, "", "translate"),
},
{
title: "润色",
icon: "square 润色",
after: "paste-result",
code: async (input, options) => chat(input, options, "", "polish"),
},
];
三、Github搜索
https://github.com/Wooden-Robot/Search-Github-PopClip
这是一个简单的 PopClip 插件,可以让您在 Mac 上直接搜索 Github 项目。只需选中要搜索的文本并触发插件,您无需复制粘贴即可快速查找结果。
功能
选中文本后,单击 Github 图标即可在 Github 上搜索。
在默认浏览器中打开搜索结果。
快速高效的搜索体验。
安装
下载 Search_Github_Extension.popclipextz 文件。
双击文件,安装该插件到 PopClip。
安装完成后,您可以在任何应用中选中文本,点击 PopClip 菜单中的 Github 按钮进行搜索。
四、文本发送到 flomo
https://github.com/extrastu/popclip-flomoplus
主作 SendToFlomo 将所选文本发送到 flomo。
配置
API 密钥
要使用此扩展,您需要为其提供 flomo 的 API 密钥 帐户。要获取 API 密钥:
在此处注册 flomo 帐户: https://flomoapp.com/
在此处生成 API 密钥:https://v.flomoapp.com/mine?source=incoming_webhook
将 API 密钥复制并粘贴到 API 密钥字段中 扩展的设置。
五、本地GPT-SoVITS
GPT-SoVITS接入苹果MacOs效率工具PopClip
安装PopClip软件
启动GPT-SoVITS接口服务
选中shell脚本的代码,安装插件即可
https://github.com/v3ucn/GPT-SoVITS_FOR_PopClip
六、说说笔记扩展
// #popclip extension for Send to Shuo
// name: 说说笔记
// icon: square filled 说
// language: javascript
// module: true
// entitlements: [network]
// options: [{
// identifier: "siteUrl",
// label: "服务端地址",
// type: "string",
// defaultValue: "https://note.noisework.cn",
// description: "请确保地址正确,不要带末尾斜杠"
// }, {
// identifier: "token",
// label: "API Token",
// type: "string",
// description: "从设置页面获取最新Token"
// }]
async function sendToShuo(input, options) {
try {
// 参数预处理
const siteUrl = (options.siteUrl || "").replace(/\/+$/g, "");
const token = (options.token || "").trim();
const content = (input.text || "").trim();
// 验证参数
if (!/^https:\/\/[\w.-]+(:\d+)?$/.test(siteUrl)) {
throw new Error("地址格式错误,示例: https://note.noisework.cn");
}
if (!token) throw new Error("Token不能为空");
if (!content) throw new Error("选中文本不能为空");
// 发送请求
await sendRequestWithXMLHttpRequest(siteUrl, token, content);
PopClip.showText("✓ 发送成功");
} catch (error) {
handleRequestError(error);
}
}
// 使用 XMLHttpRequest 实现网络请求
function sendRequestWithXMLHttpRequest(siteUrl, token, content) {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
const url = `${siteUrl}/api/token/messages`;
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Authorization", `Bearer ${token}`);
xhr.timeout = 10000; // 设置超时时间(10秒)
// 设置回调函数
xhr.onreadystatechange = () => {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status >= 200 && xhr.status < 300) {
resolve(xhr.responseText);
} else {
let errorMsg = `请求失败 (${xhr.status})`;
try {
const data = JSON.parse(xhr.responseText);
errorMsg = data.message || errorMsg;
} catch {}
reject(new Error(errorMsg));
}
}
};
// 处理网络错误
xhr.onerror = () => reject(new Error("网络错误"));
// 处理超时错误
xhr.ontimeout = () => reject(new Error("请求超时"));
try {
// 发送请求
const payload = JSON.stringify({
content: `#Popclip\n${content}`,
type: "text"
});
xhr.send(payload);
} catch (error) {
reject(new Error("请求发送失败: " + error.message));
}
});
}
// 错误处理
function handleRequestError(error) {
console.error("请求错误:", error);
const errorMap = {
"Failed to fetch": "无法连接到服务器",
"aborted": "请求超时",
"网络错误": "网络错误",
"401": "认证失败,请检查Token",
"404": "API地址不存在"
};
const message = Object.entries(errorMap).find(([key]) =>
error.message.includes(key)
)?.[1] || `请求错误: ${error.message.split('\n')[0].slice(0, 50)}`;
PopClip.showText(`❌ ${message}`);
}
exports.actions = [{
title: "发送至说说笔记",
code: sendToShuo,
icon: "square filled 说"
}];
七、快速生成ray.so截图
介绍:将所选文本发送到 ray.so 以获得美丽的图像 您的代码。
https://github.com/dofy/PopClip-Extensions
八、Obsidian 插件
https://github.com/canburaks/obsidian-popclip
它是如何工作的?
工作流有两个部分。
安装 Popclip 扩展。
安装 Obsidian 插件。
第一部分:Popclip 扩展
您可以选择以下文本来安装扩展。填写 作为您的 Obsidian Vault 名称,并作为目标目录,该目录必须相对于 Vault 的根目录。vaultlocation
# PopClip - Obsidian extension, markdown variant
name: ObsidianClipper
icon: O
capture html: true
options:
- identifier: "vault"
label: "Vault name"
type: string
- identifier: "path"
label: "Location"
type: string
javascript: |
const vaultName = encodeURIComponent(popclip.options.vault)
const fileLocation = encodeURIComponent(popclip.options.path)
const data = {
clipping: popclip.input.markdown,
path: fileLocation || undefined,
}
let clipping = popclip.input.markdown
if (popclip.context.browserUrl.length > 0) { // append markdown source link if available
data["title"] = popclip.context.browserTitle
data["source"] = popclip.context.browserUrl
}
clipping = encodeURIComponent(JSON.stringify(data))
popclip.openUrl(`obsidian://advanced-uri?vault=${vaultName}&daily=true&heading=popclip&data=%0A${clipping}&mode=append`)
#end
安装 Obsidian 插件。
我还没有提交插件。我打算尽快提交。
因此,您需要手动安装它:
下载 Obsidian Popclip 插件的 GitHub 存储库。
复制 directory 下的文件夹。popclipdist
将复制的文件夹粘贴到 Obsidian 插件文件夹 下。popclip.obsidian/plugins
重新启动 Obsidian。
九、Bilibili搜索
一个简单的 PopClip 扩展,根据 Bilibili.com 中的选定视频直接将您带到 Bilibili.com。
https://github.com/brucemomo/PopClip-Extension-Bilibili
十、memos创建新备忘录
https://github.com/beffiy/popclip-usememos-extension
一个简单的 popclip 扩展,用于 usememos 创建新备忘录。
十一、发送到Cursor Editor
https://github.com/rizumita/composerize
一个 PopClip 扩展,用于将所选文本发送到光标编辑器的编辑器功能。它通过保留以前的剪贴板数据来安全地处理剪贴板内容。
特征
- 自动将所选文本发送到 Cursor 的书写器
- 保留剪贴板内容
- 使用错误消息优雅地处理错误
- 无需配置
用法
- 选择要发送到 Composer 的任何文本
- 单击 PopClip 菜单中的 Composerize 按钮
- 该扩展将:
- 临时存储当前的剪贴板内容
- 将所选文本发送到 Cursor 的 Composer
- 恢复以前的剪贴板内容
要求
- PopClip(推荐最新版本)
- 光标编辑器
- PopClip 的 macOS 辅助功能权限
安装
- 双击
composerize.popclipext
文件夹 - 在 PopClip 的对话框中确认安装
- 出现提示时授予必要的权限
十二、小红书搜索
划词点击图标跳转至小红书网页版搜索
下载:https://pan.quark.cn/s/6e7361338d14
解压后双击安装
十三、搜索 Z-lib 书籍
https://github.com/Wooden-Robot/Search_Z-lib_PopClip
这是一个简单的 PopClip 插件,可以让您在 Mac 上直接搜索 Z-lib 书籍。只需选中要搜索的文本并触发插件,您无需复制粘贴即可快速查找结果。
功能
- 选中文本后,单击
Z
即可在 Z-lib 上搜索。 - 在默认浏览器中打开搜索结果。
- 快速高效的搜索体验。
安装
- 下载 Search_Z-lib_Extension.popclipextz 文件。
- 双击文件,安装该插件到 PopClip。
- 安装完成后,您可以在任何应用中选中文本,点击 PopClip 菜单中的
Z
按钮进行搜索。
十四、深度求索翻译
#popclip
{"name": "深度求索翻译", "icon": "square filled 翻", "interpreter": "python3", "options": [{"identifier": "apikey", "label": "DeepSeek API Key", "type": "string"}], "after": "paste-result"}
import os
import json
import urllib.request
import urllib.error
def translate():
# 获取环境变量
text = os.environ['POPCLIP_TEXT']
api_key = os.environ['POPCLIP_OPTION_APIKEY']
# 准备请求数据
data = {
"model": "deepseek-chat",
"messages": [
{
"role": "system",
"content": "你现在是一位英文翻译专家,专注于翻译用户提供的内容。如果用户提交的内容是中文,请将其翻译成英文;如果是英文,则翻译成简体中文。请注意,你无需对内容提出任何评论或解答,仅需提供准确的翻译。"
},
{
"role": "user",
"content": text
}
],
"temperature": 0.3
}
# 准备请求
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {api_key}"
}
try:
# 创建请求
req = urllib.request.Request(
"https://api.deepseek.com/v1/chat/completions",
data=json.dumps(data).encode('utf-8'),
headers=headers,
method="POST"
)
# 发送请求
with urllib.request.urlopen(req) as response:
result = json.loads(response.read().decode('utf-8'))
translation = result['choices'][0]['message']['content'].strip()
print(translation, end='')
except urllib.error.URLError as e:
print(f"请求错误: {str(e)}", end='')
except json.JSONDecodeError:
print("JSON解析错误", end='')
except KeyError:
print("API响应格式错误", end='')
except Exception as e:
print(f"未知错误: {str(e)}", end='')
translate()