Readwise tag clean-up

This script will fix all readwise tags that mistakenly have trailing whitespaces by removing the trailing whitespace

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

作者
Jason Axley
日安装量
0
总安装量
0
评分
0 0 0
版本
1.0.0
创建于
2025-08-04
更新于
2025-08-04
大小
5.1 KB
许可证
MIT
适用于

I love Readwise! One of the Readwise apps had a bug where instead of selecting an existing tag, it would create a new tag for a value with a trailing whitespace. This caused me to have duplicates of 50 or so tags. Unfortunately, some Readwise APIs try to be "nice" and silently "trim" the whitespace from the tags so they would show up on the site as if they were totally fine - gaslighting you! This made it very hard to find all of the tags that were broken and rename them using the regular UI. Readwise mirror replaces the trailing spaces with "-" so you get a bunch of duplicate tags ending with "-".

Tags are also maintained within each book record so are not a single value you can rename and fix them everywhere.

This script will iterate through every Readwise entry. When it finds a tag ending with a trailing space, it will add a new tag with the same name but without the space. If that is successful, it will delete the tag containing the trailing space.

Setup

Authentication

Sadly, not all of the Readwise APIs allow you to just use existing browser credentials via CORS. Some require you to use the persistent API key credential. So, you'll need to use the context menu to edit the script settings and paste in the API key for those to work.

That value is ONLY stored in local script configuration so I can't access it. It uses the GM_config library to do this in case you want to verify the supply chain is secure before doing that.