Update docs and sort content

This commit is contained in:
github-actions[bot]
2025-02-21 12:39:07 +00:00
parent febcdb06a4
commit a25ea16c36
2 changed files with 3 additions and 5 deletions

View File

@ -0,0 +1,150 @@
---
toAstro: true
astroType: post
toWexin: null
toJuejin: null
title: rsshub中新增asianfanfics路由
date: 2025-02-21T00:00:00.000Z
author: KazooTTT
tags:
- 脑洞
- asianfanfics
- rss
- rsshub
description: null
slug: fragmented-notes-2025-02-21-16-38-50
published: true
category: 碎片
date_created: 2025-02-11T15:38:40.000Z
date_modified: 2025-02-21T12:35:43.000Z
---
突然想订阅 #asianfanfics 某个 Tag 或者搜索关键词的更新,打算用 rsshub 来实现,在 follow 中订阅。
举个例子:<https://www.asianfanfics.com/browse/tag/milklove/N>
代表 tag 为 milklove排序类型为 newest最近发布的所有文章
通过查看 devtool 的请求发现,所需数据并非接口而是一个静态网页:
![IMG-803E576335AF5653F8963BE7881E4DD8](/mdImages/IMG-803E576335AF5653F8963BE7881E4DD8.png)
具体的内容:
![IMG-C54B455556952B47DBE32B14D26E5548](/mdImages/IMG-C54B455556952B47DBE32B14D26E5548.png)
示例代码
[[IMG-E759B225225068DF0D09FBD60313AEF3.html]]
手动剔除掉无关的元素之后,剩下的结构为:
![IMG-5ECA04383C3D96B4A767C5A0B3463E19](/mdImages/IMG-5ECA04383C3D96B4A767C5A0B3463E19.png)
观察了一下,获取文章列表就是找到 primary-container 中的所有的.excerpt
现在再来看单个的.excerpt
``` html
<section class="excerpt">
<div class="clearfix">
<h1 class="excerpt__title">
<a href="/story/view/1623986/n-a">《出走信仰》</a>
</h1>
<div class="excerpt__meta">
<div class="excerpt__meta__main">
<div class="excerpt__meta__name">
By <a href="/profile/u/DebrisL">DebrisL </a>
Published
<time datetime="2025-02-21 06:58:08" class="text--regular">Feb 21, 2025 06:58:08
</time>
</div>
<div class="excerpt__meta__tags">
Tags &nbsp;<a href='/browse/tag/milklove'>milklove</a>
&nbsp;
</div>
<div class="excerpt__meta__views">
With
<span class="text--regular">
<strong>2</strong>
subscribers, <strong>1460</strong>
views, <strong>514</strong>
words
</span>
</div>
<div class="excerpt__meta__status">
Status <em class="text--regular">[M]</em>
</div>
</div>
</div>
</div>
</section>
```
可以从这个 excerpt 中获取到的信息
1. 链接
excerpt__title a 的 href
2. 标题
excerpt__title 的 text
3. 作者的 name
excerpt__meta__name 的 text
4. 发布时间
excerpt__meta__main time 的 datetime
而一个 rss item 需要的信息,上述内容都可以满足。
``` xml
<item>
<title>2025-W07</title>
<link>https://blog.kazoottt.top/posts/2025-W07/</link>
<guid isPermaLink="true">https://blog.kazoottt.top/posts/2025-W07/</guid>
<pubDate>Sun, 16 Feb 2025 00:00:00 GMT</pubDate>
<content:encoded> </content:encoded>
<category>周报</category>
<author>KazooTTT</author>
</item>
```
观察和调研结束,我们开始用 rsshub 来实现。
## 实现步骤
pr 地址 [feat(route): add asianfanfics route #18430](<https://github.com/DIYgod/RSSHub/pull/18430>)
rsshub 官方有很详细的新建路由文档 [Quick Start \| RSSHub](<https://docs.rsshub.app/joinus/>)
我要创建的路由有两个
1. 某个 Tag 的更新
2. 搜索关键词的更新
所以创建, lib\routes\asianfanfics 文件夹,和三个文件
- lib\routes\asianfanfics\namespace.ts
- lib\routes\asianfanfics\tag.ts
- lib\routes\asianfanfics\text-search.ts
tag 和 text-search 的分别根据上面的分析进行实现即可。代码很简单所以不做过多的介绍。
分享其他内容:
踩坑:使用 got 和 ofetch 的时候,都遇到了网站的反爬机制,报 403 forbidden。所以改为了 pptr。但是具体是为什么缺了 agent 还是什么,暂时没有去研究,这个后面有时间会再研究一下。
类型:
- L: Latest 最近更新
- N: Newest 最近发布
- O: Oldest 最早发布
- C: Completed 已完成
- OS: One Shots 短篇
这里学到了 latest 和 newest 的区别latest 是按照发布时间排序newest 是按照更新时间排序。
如何发现的,激活 latest 筛选的时候item 重点显示的是 updated
![IMG-EAB6D9A347C7926AB395DC9F5D27F42A](/mdImages/IMG-EAB6D9A347C7926AB395DC9F5D27F42A.png)
激活 newest 筛选的时候item 重点显示的是 published
![IMG-42AE74197F09A21FA3B3182045DE5126](/mdImages/IMG-42AE74197F09A21FA3B3182045DE5126.png)

View File

@ -0,0 +1,76 @@
---
astroType: post
author: KazooTTT
category: 脑洞
date: 2025-02-12T00:00:00.000Z
date_created: 2025-02-12T03:06:45.000Z
date_modified: 2025-02-21T08:22:20.000Z
description: null
published: true
slug: handling-markdown-image-links-containing-spaces-causing-preview-failures
tags:
- 脑洞
title: 处理markdown图片链接包含空格导致无法预览图片的问题
toAstro: true
toJuejin: null
toWexin: null
---
![IMG-4792F6481346E5FBAA24C7291676135F-1](<https://pictures.kazoottt.top/2025/02/20250221-4792f6481346e5fbaa24c7291676135f.jpg>)
在很久之前有写过 [md路径正确但是图片不显示的原因](https://notes.kazoottt.top/05-临时/01-草稿箱/md路径正确但是图片不显示的原因)
具体来说就是flowus如果上传了多张图片到一个md然后导出的时候会出现在obsidian或者vscode中无法正常查看图片的情况。
这是因为这些图片被命名为 image.png image 1.png image 2.png, 然后在md中的语法为:
`![alt 属性文本](<图片地址>)`
所以导出的时候写法如下:
![alt text](<https://pictures.kazoottt.top/2025/02/20250221-050047f17cb009229dee6327839820b6.png>)
但是因为路径中包含空格,所以这些编辑器无法正确地识别到。
有两种方式来解决这个问题:
1. 把空格替换为%20
2. 把链接使用<>包裹起来
为了更好兼容性和更符合md的规范我使用了第二种方法也就是把链接使用<>包裹起来
[CommonMark](<https://spec.commonmark.org/0.30/#link-reference-definition>)
![alt text](<https://pictures.kazoottt.top/2025/02/20250221-d553bacdc647838e5684f4366bee55f1.png>)
<>包裹起来的链接会被视为一个整体,这样就无需担心空格的问题了
处理方法如下:
## 方法一obsidian + linter + 正则表达式处理
在obsidian中安装linter插件然后在自定义配置中添加正则表达式处理
![alt text](<https://pictures.kazoottt.top/2025/02/20250221-741d60dc1e53b648a7292cf2fb082598.png>)
第一栏填写:`(?<=\]\()(?!<)(.+?)(?!=>)(?=\))`
第二栏填写 `gm`
第三栏填写:`<$1>`
---
如果你开启了保存后就运行linter的话那么当前文件的链接就会被包裹起来了
![IMG-A76323EF3B622BCF0A912CEAD848C0A0](<https://pictures.kazoottt.top/2025/02/20250221-a76323ef3b622bcf0a912cead848c0a0.png>)
如果你想要一次性批量修改全部的话保险起见可以先git commit或者手动复制备份一下
然后windows按下 ctrl + pmac 按下 cmd + p。
然后搜索 `linter` 然后选择到格式化所有文件,按下回车,就能全部处理了
![IMG-5D8A27823A22095AC71D22EA80049C00](<https://pictures.kazoottt.top/2025/02/20250221-5d8a27823a22095ac71d22ea80049c00.png>)
如果批量格式化有问题就用git回退一下或者手动还原一下之前备份的内容