接口API

GitHub

网易音乐

image-20221205130123855

博客园

微博

社会语录

名称 必填 类型 说明
type string 选择输出分类[hitokoto|en|social|soup|fart|zha],为空默认hitokoto
code string 选择输出格式[json|js]

hitokoto(一言)、en(中英文)、social(社会语录)、soup(毒鸡汤)、fart(彩虹屁)、zha(渣男语录)

大西瓜

https://api.no0a.cn/

爬取icon

1
2
3
4
5
6
7
8
9
10
11
思路: 

第一种方法
如果想要获取一个网站的页面logo,最简单且最有效的办法就是在它的网址后面加上/favicon.ico
例如: https://www.baidu.com/favicon.ico
就可以获取了!

第二种方法
在浏览器界面按下F12,打开开发者模式,在 Elements中打开<head>...</head>标签
找到<link....> 中含有favicon或ico的链接,复制即可
因为图标是放在head部分的link中,通过设置rel="icon"或者 rel="shortcut icon" 来让浏览器识别

API: https://api.iowen.cn/doc/favicon.html

1
https://api.iowen.cn/favicon/www.yujing.fit.png

==注意:==不需要 http(s)😕/ ,且结尾必须填 .png

https://favicongrabber.com/

1
http://favicongrabber.com/api/grab/github.com

1
www.google.com/s2/favicons?domain=https://yujing.fit/

爬取标题

1
https://api.no0a.cn/api/sitetitle/query?url=https://yujing.fit
1
{"status":1,"title":"J's Blog"}
1
2
3
4
5
6
7
8
9
10
async getTitles(url) {
// 获取网站标题
return await fetch(url)
.then((res) => res.text())
.then((html) => {
const title = html.match(/<title>(.*?)<\/title>/);
console.log(title);
return title ? title[1] : "";
});
},