first commit

This commit is contained in:
CommunistSpectre
2023-08-02 17:39:27 +08:00
commit 53fd43c6ef
81 changed files with 5742 additions and 0 deletions

46
Extras/Buttons.md Normal file
View File

@@ -0,0 +1,46 @@
---
Created: 2023-07-10 15:54:56
Modified: 2023-07-10 16:56:32
---
```ad-note
title:快捷操作
`button-doubanbook` `button-doubanmovie`
`button-textools` `button-table`
```
```button
name <svg t="1636170726137" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="31935" width="30" height="30"><path d="M918.016 384l0 128-128 0 0 297.984-128 0 0-297.984-128 0 0-128 384 0zM105.984 169.984l555.989333 0 0 128-214.016 0 0 512-128 0 0-512-214.016 0 0-128z" p-id="31936" fill="#1296db"></path></svg>文本处理
type command
action Hotkeys for specific files: Open Extras/文本处理
class circle_btn blank
```
^button-textools
```button
name <svg t="1636173144891" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12344" width="30" height="30"><path d="M807.845873 105.546818l-592.286316 0c-92.76818 0-167.695184 74.928027-167.695184 167.695184l0 476.921428c0 92.76818 74.928027 168.289753 167.695184 168.289753l592.286316 0c92.76818 0 168.289753-75.522597 168.289753-168.289753l0-476.921428C976.135627 180.473821 900.61303 105.546818 807.845873 105.546818zM77.596938 750.163429l0-406.156409 179.588619 0 0 544.712575-41.627023 0C139.442391 888.720618 77.596938 826.280595 77.596938 750.163429zM488.510926 888.720618l-201.591781 0L286.919145 712.699415l201.591781 0C488.510926 712.699415 488.510926 888.720618 488.510926 888.720618zM488.510926 682.965828l-201.591781 0L286.919145 528.353217l201.591781 0C488.510926 528.353217 488.510926 682.965828 488.510926 682.965828zM488.510926 498.61963l-201.591781 0 0-154.61261 201.591781 0C488.510926 344.00702 488.510926 498.61963 488.510926 498.61963zM719.835272 888.720618 518.243491 888.720618 518.243491 712.699415l201.591781 0L719.835272 888.720618zM719.835272 682.965828 518.243491 682.965828 518.243491 528.353217l201.591781 0L719.835272 682.965828zM719.835272 498.61963 518.243491 498.61963l0-154.61261 201.591781 0L719.835272 498.61963zM946.403062 750.163429c0 76.117166-62.440023 138.557189-138.557189 138.557189l-58.277013 0L749.56886 712.699415l196.834202 0L946.403062 750.163429zM946.403062 682.965828 749.56886 682.965828 749.56886 528.353217l196.834202 0L946.403062 682.965828zM946.403062 498.61963 749.56886 498.61963l0-154.61261 196.834202 0L946.403062 498.61963zM946.403062 314.273432l-868.805101 0 0-41.03143c0-76.117166 61.845453-137.96262 137.96262-137.96262l592.286316 0c76.117166 0 138.557189 61.845453 138.557189 137.96262L946.404085 314.273432z" p-id="12345" fill="#1296db"></path></svg>表格转换
type command
action Hotkeys for specific files: Open 50-Inbox/Website/表格转换-tableconvert
class circle_btn blank
```
^button-table
```button
name <svg t="1644570711006" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7432" width="30" height="30"><path d="M857.6 235.52v622.08H269.824c-57.344 0-103.424-46.592-103.424-103.424S212.992 650.24 269.824 650.24H788.48V97.28H235.52c-76.288 0-138.24 61.952-138.24 138.24v552.96c0 76.288 61.952 137.728 138.24 138.24h691.2V235.52h-69.12" fill="#1296db" p-id="7433"></path><path d="M304.64 719.36H788.48V788.48H304.64z" fill="#1296db" p-id="7434"></path></svg>豆瓣读书
type command
action QuickAdd: 豆瓣读书笔记
class circle_btn blank
```
^button-doubanbook
```button
name <svg t="1644570805193" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8420" width="30" height="30"><path d="M512 42.666667c259.2 0 469.333333 210.133333 469.333333 469.333333a467.84 467.84 0 0 1-136.064 330.453333l-2.858666 2.837334-5.824 5.674666a8.533333 8.533333 0 0 1-5.930667 2.389334H744.682667a4.266667 4.266667 0 0 1-2.389334-7.786667c2.197333-1.493333 4.053333-2.816 5.610667-3.904C850.496 768.106667 917.333333 647.850667 917.333333 512c0-223.850667-181.482667-405.333333-405.333333-405.333333S106.666667 288.149333 106.666667 512s181.482667 405.333333 405.333333 405.333333h418.133333c4.693333 0 8.533333 3.84 8.533334 8.533334v46.933333a8.533333 8.533333 0 0 1-8.533334 8.533333H520.533333l-0.810666-0.064L512 981.333333C252.8 981.333333 42.666667 771.2 42.666667 512S252.8 42.666667 512 42.666667z m0 576a106.666667 106.666667 0 1 1 0 213.333333 106.666667 106.666667 0 0 1 0-213.333333z m0 64a42.666667 42.666667 0 1 0 0 85.333333 42.666667 42.666667 0 0 0 0-85.333333zM298.666667 405.333333a106.666667 106.666667 0 1 1 0 213.333334 106.666667 106.666667 0 0 1 0-213.333334z m426.666666 0a106.666667 106.666667 0 1 1 0 213.333334 106.666667 106.666667 0 0 1 0-213.333334z m-426.666666 64a42.666667 42.666667 0 1 0 0 85.333334 42.666667 42.666667 0 0 0 0-85.333334z m426.666666 0a42.666667 42.666667 0 1 0 0 85.333334 42.666667 42.666667 0 0 0 0-85.333334zM512 192a106.666667 106.666667 0 1 1 0 213.333333 106.666667 106.666667 0 0 1 0-213.333333z m0 64a42.666667 42.666667 0 1 0 0 85.333333 42.666667 42.666667 0 0 0 0-85.333333z" fill="#1296db" p-id="8421"></path></svg>豆瓣电影
type command
action QuickAdd: 豆瓣观影笔记
class circle_btn blank
```
^button-doubanmovie

View File

@@ -0,0 +1,108 @@
---
Aliases:
Created: 2023-07-27 14:59:53
Modified: 2023-07-27 20:31:47
Title: OpenWrt部署
Tags: OpenWrt
---
up::[[Atlas/Card|Card]]
# 宽带拨号
账号059602115596
密码123456
LAN: IPv4 网关192.168.1.1
DHCP: 启动 101 客户数 155
# DNS 设置
223.5.5.5
# 磁盘管理
- /dev/sda1——/boot
- /dev/sda3——/overlay
- /dev/sda4——/mnt/sata1-4
- /dev/sdb1——/mnt/sata3-1
- /dev/sdc1——/mnt/usb2_7-1
- docker 迁移:/mnt/sata1-4/docker
# OpenClash 安装
```
opkg install coreutils-nohup bash iptables dnsmasq-full curl ca-certificates ipset ip-full iptables-mod-tproxy iptables-mod-extra libcap libcap-bin ruby ruby-yaml kmod-tun kmod-inet-diag unzip luci-compat luci luci-base
```
`opkg install /tmp/luci-app-openclash_0.45.87-beta_all.ipk`
订阅地址: https://api.tsutsu.one/sub?target=clash&url=https%3A%2F%2Ffast.lycorisrecoil.org%2Flink%2FayAWmBvYHVaY7rGM%3Fsub%3D1&insert=false&config=https%3A%2F%2Fcdn.staticaly.com%2Fgh%2FACL4SSR%2FACL4SSR%2Fmaster%2FClash%2Fconfig%2FACL4SSR_Online_Full_Netflix.ini&exclude=%E5%A4%87%E7%94%A8%7C%E5%AE%A2%E6%9C%8D%7C%E5%B7%A5%E4%BD%9C%E5%AE%A4%7CNext%7C%E6%97%A0%7CIPV6&filename=%E7%AE%A1%E4%BA%BA%E7%97%B4&emoji=true&list=false&tfo=false&scv=false&fdn=false&sort=false&expand=true&udp=true&new_name=true
排除无效节点全部勾选
## 插件设置
模式设置UDP 流量转发√
流量控制:路由本机代理√ 禁用 QUIC√ 绕过中国大陆 IP√
DNS 设置:本地 DNS 劫持:停用禁止 Dnsmasq 缓存 DNS√
外部控制管理页面端口9898 管理页面登录密钥OpenClash 管理页面公网域名clash.pkugsm.cf
## 覆写设置
DNS 设置:自定义上游 DNS 服务器√ 追加上游 DNS√
NameServer114.114.114.114 119.29.29.29 223.5.5.5 8.8.8.8
## 配置管理
```
- "DOMAIN-KEYWORD,mihoyo,\U0001F680 手动切换"
- "DOMAIN-KEYWORD,truthsocial,\U0001F1FA\U0001F1F2 美国节点"
```
# AdGuard Home 安装
软件包里直接装 ipk 和 luci 界面即可,配置文件已备份
网页管理端口3000
重定向 53 端口到 AdGuard Home
# iStore 安装
- SysTools 工具集
- 主机流量监控
- SFTP 服务
- FTP 服务器
- ARP 绑定
- 微信推送 ServerChan 【TG_token5108952241:AAG6pZsHMdAZN2_OXZ5ELQ_ef6TaXZCtAiY】【TG_chatid1061900965】
- 关机
- Nut
- NetData 系统监控
- 硬盘休眠
- Go-WebDAV
# 动态 DNS
查询主机名communist.top
DDNS 服务提供商cloudflare. com-v4
域名: communist.top
用户名: communistspectre@foxmail.com
密码:917c28054f6f733bab1d7eb50141088963519
使用 HTTPS√
CA 证书路径IGNORE
IP 地址来源:网络 WAN
# frp
![image.png|600](https://image.pkugsm.cf/i/2023/07/27/64c22494913ba.png)
服务端5443
令牌ouctykEweJ1EbJ8U
# 网络共享
Download /mnt/sata3-1/download
# docker
## 贴吧
BDUSS:1VGaTN4bXl3OUU3NWNTdC1HbEVsSC1uUjRGN2tkOU8teHFXOEdJakZPUWdKNjlqSVFBQUFBJCQAAAAAAAAAAAEAAACZUe8fs6TG2rXE1tCy3dKpAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACCah2MgmodjZ
STOKEN:314cebd96281a05af2f761a107be56cf68c240eeda1ad7e0390a4b312b52e856

8
Extras/Template/Card.md Normal file
View File

@@ -0,0 +1,8 @@
---
Aliases:
Created: <% tp.date.now("YYYY-MM-DD HH:mm:ss") %>
Modified:
Title: <% tp.file.title %>
Tags:
---
up::[[Atlas/Card|Card]]

40
Extras/Template/Diary.md Normal file
View File

@@ -0,0 +1,40 @@
---
Completed: 0
Created: <% tp.date.now("YYYY-MM-DD HH:mm:ss") %>
Incomplete: 2
Modified:
Tags: DailyNote
Title: <% tp.file.title %>
Total: 2
---
<%* let url = 'https://www.tianqi.com/zhangzhouxiangcheng/'
let res = await request({url: url,method: "GET"});
res = res.replace(/\n/g,'')
let dqwd = /<p class="now"><b>(\d+)<\/b><i><\/i><\/p>/.exec(res)
let tqwdfw = /<span><b>(.*?)<\/b>(.*?)<\/span>/.exec(res)
let sdfxzwx = /<dd class="shidu"><b>(.*?)<\/b><b>(.*?)<\/b><b>(.*?)<\/b><\/dd>/.exec(res)
let kqzlrcrl = /<dd class="kongqi" ><h5 style="background-color:#[0-9a-z]{6};">(.*?)<\/h5><h6>(.*?)<\/h6><span>(.*?)<br \/>(.*?)<\/span><\/dd>/.exec(res)
let 天气 = '天气:' + tqwdfw[1]
let 温度范围 = '温度:' + tqwdfw[2]
let 湿度 = sdfxzwx[1]
let 风向 = sdfxzwx[2]
let 紫外线 = sdfxzwx[3]
let 空气质量 = kqzlrcrl[2] + '' + kqzlrcrl[1]
let 日出日落 = kqzlrcrl[3] + ' ' +kqzlrcrl[4] -%>
up::[[DailyNote]]
> [!tip] << [[<% tp.date.now("YYYY-MM-DD", -1) %>]] | [[<% tp.date.now("YYYY-MM-DD", 1) %>]] >>
> <% 天气 %><% 温度范围 %><% 湿度 %><% 空气质量 %> <br>
> <% 风向 %><% 紫外线 %><% 日出日落 %>
# 学习
- [ ] <% tp.file.cursor() %>
# 生活
- [ ]
# 随笔
# 复盘

View File

@@ -0,0 +1,37 @@
---
Author: {{VALUE:author}}
Banner: "{{VALUE:cover}}"
Cover: {{VALUE:cover}}
Created: <% tp.date.now("YYYY-MM-DD HH:mm:ss") %>
Douban_url: {{VALUE:douban_url}}
ISBN: {{VALUE:isbn}}
Modified:
Pagecount: {{VALUE:pagecount}}
Publisher: {{VALUE:publish}}
Publishyear: {{VALUE:publishyear}}
Rating: {{VALUE:rating}}
Tags: Book
Title: '{{VALUE:bookname}}'
---
up:: [[Book Gallery]]
> [!bookinfo]+ **《{{VALUE:bookname}}》**
> ![bookcover|400]( {{VALUE:cover}} )
>
| 属性 | 内容 |
|:------ |:------------------------------------------ |
| ISBN | {{VALUE:isbn}} |
| 作者 | {{VALUE:author}} |
| 出版年 | {{VALUE:publishyear}} |
| 出版社 | {{VALUE:publish}} |
| 来源 | [{{VALUE:bookname}}]({{VALUE:douban_url}}) |
| 评分 | {{VALUE:rating}} |
| 页码 | {{VALUE:pagecount}} |
> [!abstract]- **内容简介**
>
《{{VALUE:bookname}}》
{{VALUE:intro}}
{{VALUE:authorintro}}
## 心得体会

View File

@@ -0,0 +1,39 @@
---
Alias: {{VALUE:alias}}
Banner: {{VALUE:banner}}
Country: {{VALUE:country}}
Cover: {{VALUE:Poster}}
Created: <% tp.date.now("YYYY-MM-DD HH:mm:ss") %>
Director: {{VALUE:director}}
Douban_url: {{VALUE:douban_url}}
Genre: {{VALUE:genre}}
IMDb: {{VALUE:IMDb}}
Language: {{VALUE:language}}
Lead: {{VALUE:lead}}
Modified:
Rating: {{VALUE:rating}}
Tags: Movie
Time: {{VALUE:filmlength}}
Title: {{VALUE:fileName}}
Year: {{VALUE:year}}
---
up:: [[Movie Gallery]]
> [!bookinfo|noicon]+ **《{{VALUE:fileName}}》**
> ![bookcover|400]( {{VALUE:Poster}} )
>
| 属性 | 内容 |
|:---- |:------------------------------------------ |
| 导演 | {{VALUE:director}} |
| 主演 | {{VALUE:lead}} |
| 上映 | {{VALUE:year}} |
| 时长 | {{VALUE:filmlength}}分钟 |
| 来源 | [{{VALUE:fileName}}]({{VALUE:douban_url}}) |
| 评分 | {{VALUE:rating}} |
| 分类 | {{VALUE:genre}} |
| IMDb | {{VALUE:IMDb}} |
> [!abstract] **内容简介**
> {{VALUE:plot}}
>
## 观影体会

8
Extras/Template/MOC.md Normal file
View File

@@ -0,0 +1,8 @@
---
Aliases:
Created: <% tp.date.now("YYYY-MM-DD HH:mm:ss") %>
Modified:
Title: <% tp.file.title %>
Tags: MOC
---
up::[[Amadeus]]

11
Extras/Template/Task.md Normal file
View File

@@ -0,0 +1,11 @@
---
Completed:
Created: <% tp.date.now("YYYY-MM-DD HH:mm:ss") %>
Incomplete:
Modified:
Tags: Task
Title: <% tp.file.title %>
Total:
---
# <% tp.file.cursor() %>

View File

@@ -0,0 +1,23 @@
---
Created: <% tp.date.now("YYYY-MM-DD HH:mm:ss") %>
Modified:
Title: <% tp.file.title %>
Tags: DailyNote
---
up::[[DailyNote]]
# 本周日志
[[<% tp.date.weekday("YYYY-MM-DD", 0) %>]] | [[<% tp.date.weekday("YYYY-MM-DD", 1) %>]] | [[<% tp.date.weekday("YYYY-MM-DD", 2) %>]] | [[<% tp.date.weekday("YYYY-MM-DD", 3) %>]] | [[<% tp.date.weekday("YYYY-MM-DD", 4) %>]] | [[<% tp.date.weekday("YYYY-MM-DD", 5) %>]] | [[<% tp.date.weekday("YYYY-MM-DD", 6) %>]]
# 本周未完成任务
```tasks
not done
due in (<% tp.date.weekday("YYYY-MM-DD", 0) %> <% tp.date.weekday("YYYY-MM-DD", 6) %>)
path includes Calendar
hide backlink
hide edit button
```
# 本周学习时间分布
# 本周总结

207
Extras/bookfromdouban.js Normal file
View File

@@ -0,0 +1,207 @@
//2022-01-28 by Cuman
//脚本可以从获取网址信息,访问豆瓣图书网站抓取图书基本信息字段。
const notice = (msg) => new Notice(msg, 5000);
const log = (msg) => console.log(msg);
module.exports = bookfromdouban
let QuickAdd;
async function bookfromdouban(params) {
QuickAdd = params;
const isbn_reg = /^(?=(?:\D*\d){10}(?:(?:\D*\d){3})?$)[\d-]+$/g;
const http_reg = /(http:\/\/|https:\/\/)((\w|=|\?|\.|\/|&|-)+)/g;
const http_reg_book = /(http:\/\/book|https:\/\/book|m)((\w|=|\?|\.|\/|&|-)+)/g;
let detailurl;
const query = await QuickAdd.quickAddApi.inputPrompt(
"请输入豆瓣图书网址或者ISBN:"
);
if (!query) {
notice("No url entered.");
throw new Error("No url entered.");
}
if (isbn_reg.exec(query)) {
isbn = query.replace(/-/g, "");
detailurl= await getBookByisbn(isbn);
}else
{
if (!http_reg.exec(query)) {
new Notice('复制的内容需要包含网址或者ISBN码', 3000);
throw new Error("No results found.");
}else
{
detailurl = query.match(http_reg)[0];
}
}
console.log('detailUrl:'+detailurl);
if (http_reg_book.exec(detailurl)) {
let bookdata = await getbookByurl(detailurl);
if(bookdata)
new Notice('图书数据获取成功!', 3000);
QuickAdd.variables = {
...bookdata
};
}else{
new Notice('只能解析book.douban.com相关网址', 3000);
throw new Error("No results found.");
}
}
function isNotEmptyStr(s) {
s = s.trim();
if (typeof s == 'string' && s.length > 0) {
return true
}
return false
}
async function getbookByurl(url) {
let page = await urlGet(url);
if (!page) {
notice("No results found.");
throw new Error("No results found.");
}
let p = new DOMParser();
let doc = p.parseFromString(page, "text/html");
let $ = s => doc.querySelector(s);
let $2 = z => doc.querySelectorAll(z);
let author = '';
let bookname = '';
bookname = $("meta[property='og:title']")?.content
//author = $("meta[property='book:author']")?.content
// let intro_class_list = $2(".intro");
// let intro = '';
// if (intro_class_list) {
// intro = $("#link-report .intro").innerText;
// let regx = /<[^>]*>|<\/[^>]*>/gm;
// if (intro) {
// intro = intro.replace('(展开全部)', "");
// intro = intro.replace(regx, "").trim();
// intro = intro.replace(/\s\s\s\s/gm, "\n");
// intro = intro.replace(/=*/gm, "");
// }
// }
//原文摘录和作者简介 from https://github.com/LumosLovegood/myScripts/blob/main/DoubanAllInOne/doubanInOne.js
let intro = '';
let authorintro = " ";
var temp1 = $("h2");
if(temp1.innerText.includes("内容简介")){
var temp2 = temp1.nextElementSibling.querySelectorAll("div.intro")
var temp3 = temp2[temp2.length-1].querySelectorAll("p");
for(var i=0;i<temp3.length;i++){
intro = intro+temp3[i]?.textContent+"\n";
}
try{
temp2 = $2("h2")[1].nextElementSibling.querySelectorAll("div.intro");
temp3 = temp2[temp2.length-1].querySelectorAll("p");
for(var i=0;i<temp3.length;i++){
authorintro = authorintro+temp3[i]?.textContent+"\n";
}
}catch(e){
new Notice("没有作者简介");
}
}else if(temp1.innerText.includes("作者简介")){
var temp2 = temp1.nextElementSibling.querySelectorAll("div.intro")
var temp3 = temp2[temp2.length-1].querySelectorAll("p");
for(var i=0;i<temp3.length;i++){
authorintro = authorintro+temp3[i]?.textContent+"\n";
}
}
// console.log(authorintro,'11')
//原文摘录
let quote1 = " ";
let quote2 = " ";
let quoteList = $2("figure");
let sourceList = $2("figcaption");
if(quoteList.length!=0){
quote1 = quoteList[0]?.childNodes[0]?.textContent.replace(/(\r\n|\n)[\t\s]*(\r\n|\n)/g,"\n").replace(/[  ]+/g,"").replace(/\(/g,"").trim()+"\n"+sourceList[0]?.textContent.replace(/\s/g,"").trim();
if(quoteList[1])
quote2 = quoteList[1]?.childNodes[0]?.textContent.replace(/(\r\n|\n)[\t\s]*(\r\n|\n)/g,"\n").replace(/[  ]+/g,"").replace(/\(/g,"").trim()+"\n"+sourceList[1]?.textContent.replace(/\s/g,"").trim();
}
//console.log(quoteList,'22')
/*******************************************/
intro=isNotEmptyStr(intro)?intro.replace(/<[^>]*>|<\/[^>]*>/gm, "").trim().replace(/\s\s\s\s/gm, "\n").replace(/=*/gm, ""):' ';
authorintro=isNotEmptyStr(authorintro)?'> [!tip]- **作者简介**\n>\n'+authorintro:' ';
quote1=isNotEmptyStr(quote1)?'> [!quote]- **原文摘录**\n>\n'+'>>'+quote1:' ';
quote2=isNotEmptyStr(quote2)?'>\n>> '+quote2:' ';
let bookinfo = {};
let regauthor= /作者:([\s\S]*)(?=出版社:)/g;
let regpagecount = /页数:.(\d*)/g;
let regpublish = /出版社:\W(.*)/g;
let regpublishyear = /出版年:\W(.*)/g;
let str =$("#info")?.innerText;
author= regauthor.exec(str)
author=(author==null)?'未知':author[1].trim().replace(/\n|\r/g,"").replace(/\ +/g,"");
let pages=regpagecount.exec(str);
bookinfo.pagecount=(pages==null)?'0':pages[1].trim();
let publish=regpublish.exec(str);
bookinfo.publish=(publish==null)?'未知':publish[1].trim();
let publishyear=regpublishyear.exec(str);
bookinfo.publishyear=(publishyear==null)?'未知':publishyear[1].trim();
//bookinfo.publish=regpublish.exec(str)[1]?.trim()??'未知';
bookinfo.bookname =bookname;
bookinfo.filename =bookname.replace(/(^\s*)|\^|\.|\*|\?|\!|\/|\\|\$|\#|\&|\||,|\[|\]|\{|\}|\(|\)|\-|\+|\=|(\s*$)/g, "").replace(/[\\\\/:*?\"<>|]/g,"_");
bookinfo.cover = $("meta[property='og:image']")?.content;
bookinfo.type = 'book';
bookinfo.description = $("meta[property='og:description']")?.content;
bookinfo.douban_url = $("meta[property='og:url']")?.content;
bookinfo.author = "'"+ author +"'";
bookinfo.isbn = $("meta[property='book:isbn']")?.content;
bookinfo.rating = $("#interest_sectl > div > div.rating_self > strong")?.textContent??'-';
bookinfo.intro = intro;
bookinfo.authorintro =authorintro;
bookinfo.quote1=quote1;
bookinfo.quote2=quote2;
for(var i in bookinfo){
if(bookinfo[i]=="" || bookinfo[i]== null){
bookinfo[i]="未知";
}
}
return bookinfo;
}
async function getBookByisbn(isbn){
let isbnurl = "https://m.douban.com/search/?query="+isbn;
let page = await urlGet(isbnurl);
if (!page) {
notice("No results found.");
throw new Error("No results found.");
}
let p = new DOMParser();
let doc = p.parseFromString(page, "text/html");
let $ = s => doc.querySelector(s);
let title = $("div.subject-info span")?.textContent;
let detailUrl = String($("ul li a").href).replace("app://obsidian.md","https://m.douban.com");
if (!detailUrl){
return null;
}
return detailUrl;
}
async function urlGet(url) {
console.log(url);
let finalURL = new URL(url);
const res = await request({
url: finalURL.href,
method: "GET",
cache: "no-cache",
headers: {
"Content-Type": "text/html; charset=utf-8",
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.100.4758.11 Safari/537.36'
},
});
return res;
}

131
Extras/moviefromdouban.js Normal file
View File

@@ -0,0 +1,131 @@
//2022-02-15 by Cuman
//脚本可以从获取网址信息,访问豆瓣电影网站抓取电影基本信息字段。
const notice = (msg) => new Notice(msg, 5000);
const log = (msg) => console.log(msg);
module.exports = moviefromdouban
let QuickAdd;
async function moviefromdouban(params) {
QuickAdd = params;
const http_reg = /(http:\/\/|https:\/\/)((\w|=|\?|\.|\/|&|-)+)/g;
const http_reg_movie = /(http:\/\/movie|https:\/\/movie)((\w|=|\?|\.|\/|&|-)+)/g;
const query = await QuickAdd.quickAddApi.inputPrompt(
"请输入豆瓣电影网址:"
);
if (!query) {
notice("No url entered.");
throw new Error("No url entered.");
}
if (!http_reg.exec(query)) {
new Notice('复制的内容需要包含网址', 3000);
throw new Error("No results found.");
}
const url = query.match(http_reg)[0];
console.log(url);
if (http_reg_movie.exec(url)) {
let moviedata = await getmovieByurl(url);
if(moviedata)
new Notice('电影数据获取成功!', 3000);
QuickAdd.variables = {
...moviedata
};
}else
{
new Notice('只能解析movie.douban.com相关网址', 3000);
throw new Error("No results found.");
}
}
async function getmovieByurl(url) {
let page = await urlGet(url);
if (!page) {
notice("No results found.");
throw new Error("No results found.");
}
let p = new DOMParser();
let doc = p.parseFromString(page, "text/html");
let $ = s => doc.querySelector(s);
let director = '';
let moviename = '';
moviename = $("meta[property='og:title']")?.content
director = $("meta[property='video:director']")?.content
summary = $("span[property='v:summary']")?.textContent??'-';
genre = $("span[property='v:genre']")?.textContent??'-';
console.log(genre)
let regx = /<[^>]*>|<\/[^>]*>/gm;
if (summary) {
summary = summary.replace('(展开全部)', "");
summary = summary.replace(regx, "").trim();
summary = summary.replace(/\s\s\s\s/gm, "\n");
}
let movieinfo = {};
let reglead= /主演:([\s\S]*)(?=类型:)/g;
let regfilmlength = /片长:.(\d*)/g;
let regIMDb = /IMDb:.\w(.*)/g;
let regalias = /又名:([\s\S]*)(?=IMDb:)/g;
let reglanguage =/语言:([\s\S]*)(?=上映日期:)/g;
let regcountry = /制片国家\/地区:([\s\S]*)(?=语言:)/g;
let str =$("#info")?.innerText;
let lead= reglead.exec(str)
lead=(lead==null)?'未知':lead[1].trim().replace(/\n|\r/g,"").replace(/\ +/g,"");
movieinfo.lead = "'"+ lead +"'";
let filmlength=regfilmlength.exec(str);
movieinfo.filmlength=(filmlength==null)?'0':filmlength[1].trim();
let IMDb=regIMDb.exec(str);
movieinfo.IMDb=(IMDb==null)?'未知':IMDb[1].trim();
let alias=regalias.exec(str);
movieinfo.alias=(alias==null)?'未知':alias[1].trim();
movieinfo.alias = '"'+ movieinfo.alias +'"';
let language=reglanguage.exec(str);
movieinfo.language=(language==null)?'未知':language[1].trim();
let country=regcountry.exec(str);
movieinfo.country=(country==null)?'未知':country[1].trim();
movieinfo.fileName =moviename.replace(/[\/\\\:\*\?\"\<\>\|│]/gm, "_");
movieinfo.Poster = $("meta[property='og:image']")?.content;
movieinfo.type = 'movie';
movieinfo.description = $("meta[property='og:description']")?.content;
movieinfo.douban_url = $("meta[property='og:url']")?.content;
movieinfo.director = "'"+ director +"'";
movieinfo.genre = genre;
movieinfo.rating = $("#interest_sectl > div > div.rating_self > strong")?.textContent??'-';
movieinfo.plot = summary;
movieinfo.runtime = $("span[property='v:runtime']")?.textContent??'-';
movieinfo.year = $("span[property='v:initialReleaseDate']")?.textContent??'-';
movieinfo.banner= movieinfo.Poster.replace('s_ratio_poster', "1");
for(var i in movieinfo){
if(movieinfo[i]=="" || movieinfo[i]== null){
movieinfo[i]="未知";
}
}
return movieinfo;
}
async function urlGet(url) {
let finalURL = new URL(url);
let headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.100.4758.11 Safari/537.36'
};
const res = await request({
url: finalURL.href,
method: "GET",
cache: "no-cache",
headers: {
"Content-Type": "text/html; charset=utf-8",
},
});
return res;
}

133
Extras/movies.js Normal file
View File

@@ -0,0 +1,133 @@
const notice = (msg) => new Notice(msg, 5000);
const log = (msg) => console.log(msg);
const API_KEY_OPTION = "OMDb API Key";
const API_URL = "http://www.omdbapi.com/";
module.exports = {
entry: start,
settings: {
name: "Movie Script",
author: "Christian B. B. Houmann",
options: {
[API_KEY_OPTION]: {
type: "text",
defaultValue: "",
placeholder: "OMDb API Key",
},
},
},
};
let QuickAdd;
let Settings;
async function start(params, settings) {
QuickAdd = params;
Settings = settings;
const query = await QuickAdd.quickAddApi.inputPrompt(
"Enter movie title or IMDB ID: "
);
if (!query) {
notice("No query entered.");
throw new Error("No query entered.");
}
let selectedShow;
if (isImdbId(query)) {
selectedShow = await getByImdbId(query);
} else {
const results = await getByQuery(query);
const choice = await QuickAdd.quickAddApi.suggester(
results.map(formatTitleForSuggestion),
results
);
if (!choice) {
notice("No choice selected.");
throw new Error("No choice selected.");
}
selectedShow = await getByImdbId(choice.imdbID);
}
QuickAdd.variables = {
...selectedShow,
actorLinks: linkifyList(selectedShow.Actors.split(",")),
genreLinks: linkifyList(selectedShow.Genre.split(",")),
directorLink:
selectedShow.Director === "N/A" ? " " : `[[${selectedShow.Director}]]`,
fileName: replaceIllegalFileNameCharactersInString(selectedShow.Title),
typeLink: `[[${selectedShow.Type === "movie" ? "Movies" : "Series"}]]`,
};
}
function isImdbId(str) {
return /^tt\d+$/.test(str);
}
function formatTitleForSuggestion(resultItem) {
return `(${resultItem.Type === "movie" ? "M" : "TV"}) ${resultItem.Title} (${
resultItem.Year
})`;
}
async function getByQuery(query) {
const searchResults = await apiGet(API_URL, {
s: query,
});
if (!searchResults.Search || !searchResults.Search.length) {
notice("No results found.");
throw new Error("No results found.");
}
return searchResults.Search;
}
async function getByImdbId(id) {
const res = await apiGet(API_URL, {
i: id,
});
if (!res) {
notice("No results found.");
throw new Error("No results found.");
}
return res;
}
function linkifyList(list) {
if (list.length === 0) return "";
if (list.length === 1) return `[[${list[0]}]]`;
return list.map((item) => `[[${item.trim()}]]`).join(", ");
}
function replaceIllegalFileNameCharactersInString(string) {
return string.replace(/[\\,#%&\{\}\/*<>?$\'\":@]*/g, "");
}
async function apiGet(url, data) {
let finalURL = new URL(url);
if (data)
Object.keys(data).forEach((key) =>
finalURL.searchParams.append(key, data[key])
);
finalURL.searchParams.append("apikey", Settings[API_KEY_OPTION]);
const res = await request({
url: finalURL.href,
method: "GET",
cache: "no-cache",
headers: {
"Content-Type": "application/json",
},
});
return JSON.parse(res);
}

1
Extras/文本处理.md Normal file
View File

@@ -0,0 +1 @@
<div style="display: block; position: absolute; left: 0; top: 0; width: 100%; height: 100%; --aspect-ratio:9/16; padding-bottom: calc(var(--aspect-ratio) * 100%);"><iframe src="https://mytexttools.com/" allow="fullscreen" style="position: absolute; top: 0px; left: 0px; border:none; height: 100%; width: 100%;"></iframe></div>

4
Extras/表格转换.md Normal file
View File

@@ -0,0 +1,4 @@
<div style="height:600px;margin:-100px 0px -40px -40px;" >
<iFrame id="carbon-iframe" src="https://tableconvert.com/" width="100%" height="1200" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes">
</iFrame>
</div>