From 19bc1409d9e8499a806718215bac53e1767c3c13 Mon Sep 17 00:00:00 2001 From: apple050620312 Date: Thu, 10 Sep 2026 22:13:43 +0800 Subject: [PATCH 1/3] feat: add Xiaohongshu support via EmbedEZ --- README.md | 18 +++++++++++++++++- config.yml | 1 + .../2026_09_10_010100_add_xiaohongshu.py | 19 +++++++++++++++++++ database/models/Guild.py | 1 + locales/en-US.yml | 2 +- src/settings.py | 9 +++++++++ src/websites.py | 16 ++++++++++++++++ 7 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 database/migrations/2026_09_10_010100_add_xiaohongshu.py diff --git a/README.md b/README.md index 6a9d1ae..ceb9651 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ that contains a better embed (that allows to play videos directly in Discord, fo ## Features & Highlights - Supports Twitter, Nitter, Instagram, TikTok, Reddit, Threads, Bluesky, Snapchat, Facebook, Pixiv, Twitch, Spotify, - DeviantArt, Newgrounds, Mastodon, Tumblr, BiliBili, Pinterest, IFunny, YouTube, Imgur, Weibo, Fur Affinity, + DeviantArt, Newgrounds, Mastodon, Tumblr, BiliBili, Xiaohongshu, Pinterest, IFunny, YouTube, Imgur, Weibo, Fur Affinity, Rule34.xxx, Danbooru, Gelbooru, e621, e926, Realbooru, Hypnohub, Konachan, Yande.re, Derpibooru, Rule34.paheal, XBooru, TBIB, and any custom websites of your choice - Posts translation @@ -475,6 +475,22 @@ _Are you aware of any other fixer that isn't included here? Feel free to open an - Other official public instances/redirects: `ppxiv.net` - Pinterest Pinterest - [EmbedEZ • pinterestez.com](https://embedez.com) *Used by FixTweetBot* +- 📕 Xiaohongshu + - [EmbedEZ](https://embedez.com) *Used by FixTweetBot* +
+ Comparison table + + | Link type / Feature | [EmbedEZ](https://embedez.com) | Link example | + |---------------------------|--------------------------------|---------------------------------------------------| + | `/explore/:id` | ✔️ | https://www.xiaohongshu.com/explore/68f244ec000000000d04634f | + | `/discovery/item/:id` | ✔️ | https://www.xiaohongshu.com/discovery/item/68f244ec000000000d04634f | + | `/:type/:id` short link | ✔️ | https://xhslink.com/a/123 | + | Translation | ✔️ | / | + | Normal view | ✔️ | / | + | Direct view | ✔️ | / | + + > Tested the 10/09/2026 +
- IFunny IFunny - [EmbedEZ • ifunnyez.co](https://embedez.com) *Used by FixTweetBot* - Youtube YouTube diff --git a/config.yml b/config.yml index cbea4fd..496c854 100644 --- a/config.yml +++ b/config.yml @@ -38,6 +38,7 @@ emoji: twitch: "🎮" spotify: "🎵" bilibili: "📺" + xiaohongshu: "📕" ifunny: "🙂" furaffinity: "🐾" youtube: "📺" diff --git a/database/migrations/2026_09_10_010100_add_xiaohongshu.py b/database/migrations/2026_09_10_010100_add_xiaohongshu.py new file mode 100644 index 0000000..a0b6f7d --- /dev/null +++ b/database/migrations/2026_09_10_010100_add_xiaohongshu.py @@ -0,0 +1,19 @@ +"""AddXiaohongshu Migration.""" + +from masoniteorm.migrations import Migration + + +class AddXiaohongshu(Migration): + def up(self): + """Add Xiaohongshu website settings.""" + with self.schema.table("guilds") as table: + table.boolean("xiaohongshu").default(True) + table.enum("xiaohongshu_view", ["normal", "direct_media"]).default("normal").after("xiaohongshu") + table.boolean("xiaohongshu_tr").default(False).after("xiaohongshu_view") + + def down(self): + """Remove Xiaohongshu website settings.""" + with self.schema.table("guilds") as table: + table.drop_column("xiaohongshu") + table.drop_column("xiaohongshu_view") + table.drop_column("xiaohongshu_tr") diff --git a/database/models/Guild.py b/database/models/Guild.py index 21ce797..f2ccdf9 100644 --- a/database/models/Guild.py +++ b/database/models/Guild.py @@ -74,6 +74,7 @@ class Guild(DiscordRepresentation): 'weibo_view': EmbedEzView, 'imageboards_view': EmbedEzView, 'pinterest_view': EmbedEzView, + 'xiaohongshu_view': EmbedEzView, } @has_many('id', 'guild_id') diff --git a/locales/en-US.yml b/locales/en-US.yml index ad6649a..9b0e6e2 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -296,7 +296,7 @@ misc: ## Features & Highlights - Supports Twitter, Nitter, Instagram, TikTok, Reddit, Threads, Bluesky, Snapchat, Facebook, - Pixiv, Twitch, Spotify, DeviantArt, Newgrounds, Mastodon, Tumblr, BiliBili, Pinterest, IFunny, YouTube, Imgur, + Pixiv, Twitch, Spotify, DeviantArt, Newgrounds, Mastodon, Tumblr, BiliBili, Xiaohongshu, Pinterest, IFunny, YouTube, Imgur, Weibo, Fur Affinity, Rule34.xxx, Danbooru, Gelbooru, e621, e926, Realbooru, Hypnohub, Konachan, Yande.re, Derpibooru, Rule34.paheal, XBooru, TBIB, and any custom websites of your choice and any custom websites of your choice diff --git a/src/settings.py b/src/settings.py index 0305f54..7bd7e25 100644 --- a/src/settings.py +++ b/src/settings.py @@ -1417,6 +1417,14 @@ class BilibiliSetting(WebsiteBaseSetting): proxies = {"BiliFix": "https://www.vxbilibili.com/"} +class XiaohongshuSetting(EmbedEZBaseSetting): + """Represents the Xiaohongshu setting""" + + id = 'xiaohongshu' + name = 'Xiaohongshu' + emoji = discore.config.emoji.xiaohongshu + + class IFunnySetting(EmbedEZBaseSetting): """Represents the ifunny setting""" @@ -1721,6 +1729,7 @@ def __init__(self, interaction: discore.Interaction, view: SettingsView, ctx: Da MastodonSetting(interaction, view, ctx), TumblrSetting(interaction, view, ctx), BilibiliSetting(interaction, view, ctx), + XiaohongshuSetting(interaction, view, ctx), WeiboSetting(interaction, view, ctx), ImgurSetting(interaction, view, ctx), IFunnySetting(interaction, view, ctx), diff --git a/src/websites.py b/src/websites.py index f710ee6..4002193 100644 --- a/src/websites.py +++ b/src/websites.py @@ -698,6 +698,21 @@ async def get_fixed_url(self) -> tuple[str | None, str | None]: return fixed_url, self.fixer_name +class XiaohongshuLink(EmbedEZLink): + """Xiaohongshu website.""" + + id = 'xiaohongshu' + hypertext_label = 'Xiaohongshu' + routes = generate_routes( + ["xiaohongshu.com", "xhslink.com"], + { + "/explore/:id": ["xsec_token", "xsec_source"], + "/discovery/item/:id": ["xsec_token", "xsec_source"], + "/:type/:id": ["xsec_token", "xsec_source"], + "/:id": ["xsec_token", "xsec_source"], + }) + + class IFunnyLink(EmbedEZLink): """IFunny website.""" @@ -945,6 +960,7 @@ async def get_original_url(self) -> tuple[str | None, str | None]: MastodonLink, TumblrLink, BiliBiliLink, + XiaohongshuLink, IFunnyLink, YouTubeLink, ImgurLink, From 487f88851fbd5119ec21c31693abb3b9331cee69 Mon Sep 17 00:00:00 2001 From: apple050620312 Date: Thu, 10 Sep 2026 22:29:55 +0800 Subject: [PATCH 2/3] docs: align Xiaohongshu support claims --- README.md | 20 ++++++++++---------- src/websites.py | 5 +---- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index ceb9651..f780484 100644 --- a/README.md +++ b/README.md @@ -480,16 +480,16 @@ _Are you aware of any other fixer that isn't included here? Feel free to open an
Comparison table - | Link type / Feature | [EmbedEZ](https://embedez.com) | Link example | - |---------------------------|--------------------------------|---------------------------------------------------| - | `/explore/:id` | ✔️ | https://www.xiaohongshu.com/explore/68f244ec000000000d04634f | - | `/discovery/item/:id` | ✔️ | https://www.xiaohongshu.com/discovery/item/68f244ec000000000d04634f | - | `/:type/:id` short link | ✔️ | https://xhslink.com/a/123 | - | Translation | ✔️ | / | - | Normal view | ✔️ | / | - | Direct view | ✔️ | / | - - > Tested the 10/09/2026 + | Link type | [EmbedEZ](https://embedez.com) | Link example | + |--------------------|--------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------| + | `/explore/:id` | ✔️ | https://www.xiaohongshu.com/explore/6a7a9cdb000000003301195a?xsec_token=AB483N-FfOfHY6C00apje97XpgXQ9SNRon6-WNUzBxzl4=&xsec_source=pc_feed | + | Translation | ✔️ | / | + | Normal view | ✔️ | / | + | Direct view | ✔️ | / | + | Gallery view | ❌ | / | + | Text view | ❌ | / | + + > Tested the 08/09/2026
- IFunny IFunny - [EmbedEZ • ifunnyez.co](https://embedez.com) *Used by FixTweetBot* diff --git a/src/websites.py b/src/websites.py index 4002193..5cceccc 100644 --- a/src/websites.py +++ b/src/websites.py @@ -704,12 +704,9 @@ class XiaohongshuLink(EmbedEZLink): id = 'xiaohongshu' hypertext_label = 'Xiaohongshu' routes = generate_routes( - ["xiaohongshu.com", "xhslink.com"], + "xiaohongshu.com", { "/explore/:id": ["xsec_token", "xsec_source"], - "/discovery/item/:id": ["xsec_token", "xsec_source"], - "/:type/:id": ["xsec_token", "xsec_source"], - "/:id": ["xsec_token", "xsec_source"], }) From 96d8e6a2539ed19cc3b7ff4f559a7a768cb72fd2 Mon Sep 17 00:00:00 2001 From: apple050620312 Date: Thu, 10 Sep 2026 22:39:45 +0800 Subject: [PATCH 3/3] fix: limit Xiaohongshu to verified capabilities --- README.md | 4 ++-- database/migrations/2026_09_10_010100_add_xiaohongshu.py | 4 ---- database/models/Guild.py | 1 - src/settings.py | 3 ++- src/websites.py | 2 ++ 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f780484..066a79c 100644 --- a/README.md +++ b/README.md @@ -483,9 +483,9 @@ _Are you aware of any other fixer that isn't included here? Feel free to open an | Link type | [EmbedEZ](https://embedez.com) | Link example | |--------------------|--------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `/explore/:id` | ✔️ | https://www.xiaohongshu.com/explore/6a7a9cdb000000003301195a?xsec_token=AB483N-FfOfHY6C00apje97XpgXQ9SNRon6-WNUzBxzl4=&xsec_source=pc_feed | - | Translation | ✔️ | / | + | Translation | ❌ | / | | Normal view | ✔️ | / | - | Direct view | ✔️ | / | + | Direct view | ❌ | / | | Gallery view | ❌ | / | | Text view | ❌ | / | diff --git a/database/migrations/2026_09_10_010100_add_xiaohongshu.py b/database/migrations/2026_09_10_010100_add_xiaohongshu.py index a0b6f7d..039719c 100644 --- a/database/migrations/2026_09_10_010100_add_xiaohongshu.py +++ b/database/migrations/2026_09_10_010100_add_xiaohongshu.py @@ -8,12 +8,8 @@ def up(self): """Add Xiaohongshu website settings.""" with self.schema.table("guilds") as table: table.boolean("xiaohongshu").default(True) - table.enum("xiaohongshu_view", ["normal", "direct_media"]).default("normal").after("xiaohongshu") - table.boolean("xiaohongshu_tr").default(False).after("xiaohongshu_view") def down(self): """Remove Xiaohongshu website settings.""" with self.schema.table("guilds") as table: table.drop_column("xiaohongshu") - table.drop_column("xiaohongshu_view") - table.drop_column("xiaohongshu_tr") diff --git a/database/models/Guild.py b/database/models/Guild.py index f2ccdf9..21ce797 100644 --- a/database/models/Guild.py +++ b/database/models/Guild.py @@ -74,7 +74,6 @@ class Guild(DiscordRepresentation): 'weibo_view': EmbedEzView, 'imageboards_view': EmbedEzView, 'pinterest_view': EmbedEzView, - 'xiaohongshu_view': EmbedEzView, } @has_many('id', 'guild_id') diff --git a/src/settings.py b/src/settings.py index 7bd7e25..6e1fdfb 100644 --- a/src/settings.py +++ b/src/settings.py @@ -1417,12 +1417,13 @@ class BilibiliSetting(WebsiteBaseSetting): proxies = {"BiliFix": "https://www.vxbilibili.com/"} -class XiaohongshuSetting(EmbedEZBaseSetting): +class XiaohongshuSetting(WebsiteBaseSetting): """Represents the Xiaohongshu setting""" id = 'xiaohongshu' name = 'Xiaohongshu' emoji = discore.config.emoji.xiaohongshu + proxies = {"EmbedEZ": "https://embedez.com"} class IFunnySetting(EmbedEZBaseSetting): diff --git a/src/websites.py b/src/websites.py index 5cceccc..155e651 100644 --- a/src/websites.py +++ b/src/websites.py @@ -703,6 +703,8 @@ class XiaohongshuLink(EmbedEZLink): id = 'xiaohongshu' hypertext_label = 'Xiaohongshu' + is_translation = False + subdomains = None routes = generate_routes( "xiaohongshu.com", {