Compare commits

..

11 Commits

Author SHA1 Message Date
Yaojia Wang
4afe4aab1e Add CICD
Some checks failed
continuous-integration/drone Build is failing
Build and Release / build (push) Has been cancelled
2026-03-22 17:08:55 +01:00
tan jun
b3e0efcc11 docs: Update WeChat group information in README 2026-03-21 20:23:07 +08:00
allcontributors[bot]
7364a9f52f docs: add blablabiu as a contributor for doc, and code (#552)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2026-03-10 01:00:19 +08:00
tan jun
40a484ebc8 docs: Update WeChat group information in README (#557) 2026-03-09 18:10:26 +08:00
allcontributors[bot]
5539b9fce7 docs: add blablabiu as a contributor for code (#551)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

---------

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2026-03-09 14:05:55 +08:00
Xinhao Chen
0e16f4b825 Codex/fix flaky anti hotlink test (#550)
* test: remove network dependency from anti-hotlink test

* test: add optional external anti-hotlink integration test

---------

Co-authored-by: cxh <cxh@example.com>
2026-03-09 14:05:11 +08:00
zy
38be3bad11 docs: 新增 3 月赞赏记录(勇敢的心 ¥19.99) (#544)
- 3 月合计 ¥89.95,累计收到 ¥1365.88
- 同步更新 README/README_EN 爱心汇聚 badge

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:19:36 +08:00
zy
5c8a6cc6dd docs: 更新 2026 年 3 月赞赏记录 (#538)
- 新增 3 笔赞赏:之乎者也、质数的孤独、无名大侠
- 3 月合计 ¥69.96,累计收到 ¥1345.89
- 同步更新 README/README_EN 爱心汇聚 badge

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 17:18:45 +08:00
zy
8ce415f0eb docs: 更新 2026 年 2 月捐赠记录及 badge (#537)
- 更新 2 月捐出金额 ¥310,捐赠给腾讯慈善「重疾儿童协助」
- 累计捐赠更新为 ¥1610
- 截图格式统一为 HTML table 并排展示
- 同步更新 README/README_EN 的善款已捐 badge

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 17:08:54 +08:00
zy
c294829e1b Merge pull request #536 from xpzouying/xpzouying-patch-1
Update DONATIONS.md with new donation entry
2026-03-08 17:05:14 +08:00
zy
f140de74a7 Update DONATIONS.md with new donation entry
Added donation screenshot and updated donation record.
2026-03-08 17:04:47 +08:00
14 changed files with 321 additions and 24 deletions

View File

@@ -250,6 +250,16 @@
"code",
"doc"
]
},
{
"login": "blablabiu",
"name": "Xinhao Chen",
"avatar_url": "https://avatars.githubusercontent.com/u/123888078?v=4",
"profile": "https://github.com/blablabiu",
"contributions": [
"code",
"doc"
]
}
],
"contributorsPerLine": 7,

29
.drone.yml Normal file
View File

@@ -0,0 +1,29 @@
kind: pipeline
type: kubernetes
name: build-and-push
trigger:
branch:
- main
- develop
event:
- push
- custom
steps:
- name: build-and-push
image: gcr.io/kaniko-project/executor:debug
commands:
- >
/kaniko/executor
--context=/drone/src
--dockerfile=Dockerfile
--destination=192.168.68.11:30500/xiaohongshu-mcp:${DRONE_COMMIT_SHA:0:8}
--destination=192.168.68.11:30500/xiaohongshu-mcp:latest
--insecure
--skip-tls-verify
- name: restart-deployment
image: bitnami/kubectl:latest
commands:
- kubectl rollout restart deploy/xiaohongshu-mcp -n xiaohongshu-mcp

View File

@@ -7,9 +7,9 @@
## 摘要
- 累计收到赞赏:¥ 1285.92
- 累计捐赠:¥ 1300
- 最近更新时间2026-03-01
- 累计收到赞赏:¥ 1365.88
- 累计捐赠:¥ 1610
- 最近更新时间2026-03-08
---
@@ -26,13 +26,17 @@
**本月小结**
- 收到赞赏合计:¥ 9.99
- 收到赞赏合计:¥ 89.95
- 捐出合计:待更新
**收到的赞赏**
| 日期 | 昵称 | 金额 | 备注 |
|------------|-----:|-----:|------|
| 2026-03-01 | 黄蕾 SQUASH | 9.99 | 赞赏码 |
| 2026-03-04 | 之乎者也 | 9.99 | 赞赏码 |
| 2026-03-05 | 质数的孤独 | 29.99 | 赞赏码 |
| 2026-03-06 | 无名大侠 | 19.99 | 赞赏码 |
| 2026-03-08 | 勇敢的心 | 19.99 | 赞赏码 |
### 2026-02
@@ -40,7 +44,7 @@
**本月小结**
- 收到赞赏合计:¥ 305.98
- 捐出合计:待更新
- 捐出合计:¥ 310.00,捐赠给腾讯慈善「重疾儿童协助」
**收到的赞赏**
| 日期 | 昵称 | 金额 | 备注 |
@@ -54,9 +58,12 @@
| 2026-02-22 | 小小酷 | 1.00 | 赞赏码 |
| 2026-02-27 | 陈志 | 200.00 | 赞赏码 |
捐款截图记录:
![xiaohongshu_01](https://github.com/user-attachments/assets/5c1d1cae-3a04-4730-8022-4608f0c6f3e7)
<table>
<tr>
<td><img height="400" alt="donation-2026-02-intro" src="https://github.com/user-attachments/assets/00d75786-d6b3-41b5-9ced-d2fec8b6514e" /></td>
<td><img height="400" alt="donation-2026-02" src="https://github.com/user-attachments/assets/5c1d1cae-3a04-4730-8022-4608f0c6f3e7" /></td>
</tr>
</table>
### 2026-01

View File

@@ -1,11 +1,11 @@
# xiaohongshu-mcp
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-26-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-27-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
[![善款已捐](https://img.shields.io/badge/善款已捐-CNY%201300.00-brightgreen?style=flat-square)](./DONATIONS.md)
[![爱心汇聚](https://img.shields.io/badge/爱心汇聚-CNY%201285.92-blue?style=flat-square)](./DONATIONS.md)
[![善款已捐](https://img.shields.io/badge/善款已捐-CNY%201610.00-brightgreen?style=flat-square)](./DONATIONS.md)
[![爱心汇聚](https://img.shields.io/badge/爱心汇聚-CNY%201365.88-blue?style=flat-square)](./DONATIONS.md)
[![Docker Pulls](https://img.shields.io/docker/pulls/xpzouying/xiaohongshu-mcp?style=flat-square&logo=docker)](https://hub.docker.com/r/xpzouying/xiaohongshu-mcp)
MCP for 小红书 / xiaohongshu.com。让你的 AI 助手直接访问小红书数据。
@@ -997,9 +997,9 @@ npx mcporter list xiaohongshu-mcp
**重要:在群里问问题之前,请一定要先仔细看完 README 文档以及查看 Issues。**
### 微信群
| 微信群 17 群 | 微信群 18 群 |
| 微信群 20 群 | 微信群 21 群 |
| :------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------: |
| <img src="https://github.com/user-attachments/assets/2317229c-311e-4339-b659-2a2467aa8c17" alt="WechatIMG119" width="300"> | <img src="https://github.com/user-attachments/assets/78f8c7a2-98ab-477b-bbb2-7b08551ffc99" alt="WechatIMG119" width="300"> |
| <img src="https://github.com/user-attachments/assets/16d8fe15-bcc2-40d3-81ae-47360d0d2c10" alt="WechatIMG119" width="300"> | <img src="https://github.com/user-attachments/assets/ac67ecba-f76d-4680-b961-adac1f7598ed" alt="WechatIMG119" width="300"> |
### 飞书群
@@ -1054,6 +1054,7 @@ npx mcporter list xiaohongshu-mcp
<td align="center" valign="top" width="14.28%"><a href="https://runyang.vercel.app/"><img src="https://avatars.githubusercontent.com/u/54588936?v=4?s=100" width="100px;" alt="Runyang YOU"/><br /><sub><b>Runyang YOU</b></sub></a><br /><a href="https://github.com/xpzouying/xiaohongshu-mcp/commits?author=YRYangang" title="Code">💻</a> <a href="https://github.com/xpzouying/xiaohongshu-mcp/commits?author=YRYangang" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.hnfnu.edu.cn/"><img src="https://avatars.githubusercontent.com/u/134906805?v=4?s=100" width="100px;" alt="e0_7"/><br /><sub><b>e0_7</b></sub></a><br /><a href="https://github.com/xpzouying/xiaohongshu-mcp/commits?author=Daily-AC" title="Code">💻</a> <a href="https://github.com/xpzouying/xiaohongshu-mcp/commits?author=Daily-AC" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/prehisle"><img src="https://avatars.githubusercontent.com/u/2081344?v=4?s=100" width="100px;" alt="prehisle"/><br /><sub><b>prehisle</b></sub></a><br /><a href="https://github.com/xpzouying/xiaohongshu-mcp/commits?author=prehisle" title="Code">💻</a> <a href="https://github.com/xpzouying/xiaohongshu-mcp/commits?author=prehisle" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/blablabiu"><img src="https://avatars.githubusercontent.com/u/123888078?v=4?s=100" width="100px;" alt="Xinhao Chen"/><br /><sub><b>Xinhao Chen</b></sub></a><br /><a href="https://github.com/xpzouying/xiaohongshu-mcp/commits?author=blablabiu" title="Code">💻</a> <a href="https://github.com/xpzouying/xiaohongshu-mcp/commits?author=blablabiu" title="Documentation">📖</a></td>
</tr>
</tbody>
</table>

View File

@@ -6,8 +6,8 @@
<!-- ALL-CONTRIBUTORS-BADGE:END -->
[![Philanthropy](https://img.shields.io/badge/Philanthropy-CNY%201300.00-brightgreen?style=flat-square)](./DONATIONS.md)
[![Gratitude](https://img.shields.io/badge/Gratitude-CNY%201285.92-blue?style=flat-square)](./DONATIONS.md)
[![Philanthropy](https://img.shields.io/badge/Philanthropy-CNY%201610.00-brightgreen?style=flat-square)](./DONATIONS.md)
[![Gratitude](https://img.shields.io/badge/Gratitude-CNY%201365.88-blue?style=flat-square)](./DONATIONS.md)
[![Docker Pulls](https://img.shields.io/docker/pulls/xpzouying/xiaohongshu-mcp?style=flat-square&logo=docker)](https://hub.docker.com/r/xpzouying/xiaohongshu-mcp)
MCP for RedNote (Xiaohongshu) platform.

20
k8s/argocd-app.yaml Normal file
View File

@@ -0,0 +1,20 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: xiaohongshu-mcp
namespace: argocd
spec:
project: default
source:
repoURL: https://git.colacoder.com/kai/xiaohongshu-mcp.git
targetRevision: main
path: k8s/base
destination:
server: https://kubernetes.default.svc
namespace: xiaohongshu-mcp
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true

70
k8s/base/deployment.yaml Normal file
View File

@@ -0,0 +1,70 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: xiaohongshu-mcp
namespace: xiaohongshu-mcp
labels:
app: xiaohongshu-mcp
spec:
replicas: 1
selector:
matchLabels:
app: xiaohongshu-mcp
template:
metadata:
labels:
app: xiaohongshu-mcp
spec:
containers:
- name: xiaohongshu-mcp
image: 192.168.68.11:30500/xiaohongshu-mcp:latest
imagePullPolicy: Always
ports:
- containerPort: 18060
protocol: TCP
env:
- name: ROD_BROWSER_BIN
value: "/usr/bin/google-chrome"
- name: COOKIES_PATH
value: "/app/data/cookies.json"
- name: TZ
value: "Asia/Shanghai"
resources:
requests:
cpu: 200m
memory: 512Mi
limits:
cpu: "1"
memory: 2Gi
volumeMounts:
- name: data
mountPath: /app/data
- name: images
mountPath: /app/images
- name: dshm
mountPath: /dev/shm
livenessProbe:
httpGet:
path: /health
port: 18060
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /health
port: 18060
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
volumes:
- name: data
persistentVolumeClaim:
claimName: xiaohongshu-mcp-data
- name: images
persistentVolumeClaim:
claimName: xiaohongshu-mcp-images
- name: dshm
emptyDir:
medium: Memory
sizeLimit: 256Mi

29
k8s/base/drone-rbac.yaml Normal file
View File

@@ -0,0 +1,29 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: drone-deploy
namespace: xiaohongshu-mcp
rules:
- apiGroups: ["apps"]
resources: ["deployments"]
verbs: ["get", "list", "patch", "update"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: drone-deploy
namespace: xiaohongshu-mcp
subjects:
- kind: ServiceAccount
name: default
namespace: drone
- kind: ServiceAccount
name: drone
namespace: drone
- kind: ServiceAccount
name: drone-runner-drone-runner-kube
namespace: drone
roleRef:
kind: Role
name: drone-deploy
apiGroup: rbac.authorization.k8s.io

26
k8s/base/ingress.yaml Normal file
View File

@@ -0,0 +1,26 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: xiaohongshu-mcp
namespace: xiaohongshu-mcp
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: "50m"
nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
nginx.ingress.kubernetes.io/proxy-send-timeout: "300"
spec:
ingressClassName: nginx
tls:
- hosts:
- xiaohongshu-mcp.k8s.home
secretName: xiaohongshu-mcp-tls
rules:
- host: xiaohongshu-mcp.k8s.home
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: xiaohongshu-mcp
port:
number: 18060

View File

@@ -0,0 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: xiaohongshu-mcp
resources:
- namespace.yaml
- pvc.yaml
- deployment.yaml
- service.yaml
- ingress.yaml
- drone-rbac.yaml

4
k8s/base/namespace.yaml Normal file
View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: xiaohongshu-mcp

27
k8s/base/pvc.yaml Normal file
View File

@@ -0,0 +1,27 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: xiaohongshu-mcp-data
namespace: xiaohongshu-mcp
labels:
app: xiaohongshu-mcp
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: xiaohongshu-mcp-images
namespace: xiaohongshu-mcp
labels:
app: xiaohongshu-mcp
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi

15
k8s/base/service.yaml Normal file
View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: xiaohongshu-mcp
namespace: xiaohongshu-mcp
labels:
app: xiaohongshu-mcp
spec:
type: ClusterIP
selector:
app: xiaohongshu-mcp
ports:
- port: 18060
targetPort: 18060
protocol: TCP

View File

@@ -1,6 +1,10 @@
package downloader
import (
"encoding/base64"
"fmt"
"net/http"
"net/http/httptest"
"os"
"path/filepath"
"strings"
@@ -102,9 +106,57 @@ func TestImageDownloader_generateFileName(t *testing.T) {
}
// TestDownloadImage_AntiHotlink 测试下载防盗链图片
// 验证 PR #412 的修改:添加 User-Agent 和 Referer 解决 403 问题
// 验证添加 User-Agent 和 Referer 解决 403 问题
func TestDownloadImage_AntiHotlink(t *testing.T) {
// 快科技的图片,需要 User-Agent 才能下载
// 1x1 透明 PNG避免依赖外部网络资源导致测试不稳定
const pngBase64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO7+2X8AAAAASUVORK5CYII="
pngData, err := base64.StdEncoding.DecodeString(pngBase64)
if err != nil {
t.Fatalf("解析测试图片失败: %v", err)
}
var server *httptest.Server
server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if got := r.Header.Get("User-Agent"); got == "" {
http.Error(w, "missing user-agent", http.StatusForbidden)
return
}
expectedReferer := fmt.Sprintf("%s/", server.URL)
if got := r.Header.Get("Referer"); got != expectedReferer {
http.Error(w, "invalid referer", http.StatusForbidden)
return
}
w.Header().Set("Content-Type", "image/png")
_, _ = w.Write(pngData)
}))
defer server.Close()
tempDir := t.TempDir()
downloader := NewImageDownloader(tempDir)
filePath, err := downloader.DownloadImage(server.URL + "/image.png")
if err != nil {
t.Fatalf("下载失败: %v", err)
}
info, err := os.Stat(filePath)
if err != nil {
t.Fatalf("文件不存在: %v", err)
}
if info.Size() == 0 {
t.Fatalf("下载文件为空")
}
}
// TestDownloadImage_AntiHotlink_External 集成测试:真实外网防盗链场景
// 默认跳过,设置 XHS_RUN_NETWORK_TESTS=1 后执行。
func TestDownloadImage_AntiHotlink_External(t *testing.T) {
if os.Getenv("XHS_RUN_NETWORK_TESTS") != "1" {
t.Skip("skip external network test; set XHS_RUN_NETWORK_TESTS=1 to enable")
}
testURL := "https://img1.mydrivers.com/img/20260213/s_fdac2d21214147019e629fa7f2c8802e.png"
tempDir := t.TempDir()
@@ -115,16 +167,11 @@ func TestDownloadImage_AntiHotlink(t *testing.T) {
t.Fatalf("下载失败: %v", err)
}
// 验证文件存在
info, err := os.Stat(filePath)
if err != nil {
t.Fatalf("文件不存在: %v", err)
}
// 验证文件大小合理(大于 1KB
if info.Size() < 1024 {
t.Errorf("文件太小,可能下载失败: %d bytes", info.Size())
if info.Size() == 0 {
t.Fatalf("下载文件为空")
}
t.Logf("下载成功: %s (%d bytes)", filePath, info.Size())
}