13 Commits
Author SHA1 Message Date
ansandClaude Fable 5 f8bdd7f08f feat: feed 回源支持指定 User-Agent(FeedOptions)
新增 LoadFeedWithOptions(ctx, feedURL, FeedOptions{Proxy, Timeout, UserAgent}),
LoadFeed / LoadFeedContext 签名一字不改、降级为它的包装——库自身 main.go 与四个
既有测试的 5 处调用因此零改动。

动机:调用方要把「回源 feed」和「可达性探测」用同一个 UA 发出去,两者视角不一致
则打标不可信;而此前 UA 写死在函数体里、无从覆盖。

空 UA 不原样发出而是回落默认:gofeed 无条件 Header.Set("User-Agent", …),net/http
见到空值会把整条头省掉,而不发 UA 比发任何 UA 都更容易被拒(实测有源站对无 UA
请求直接 403)。

默认值保持原样并提为导出常量 DefaultUserAgent。顺带把它的 doc comment 从「不知道
当年为什么设成 Chrome」改成实测得出的可检验规则:约束是「不得是 HTTP 库出厂 UA、
不得为空」,而非「必须是浏览器」——feed.xyzfm.space 对 "Gofeed/1.0"(ec79b8b 之前
本函数实际发出的值)与 "Go-http-client/1.1" 返回 403 且响应头写明
X-Tengine-Error: denied by UA ACL = blacklist,而 Chrome、txpodcast/1.0、
podcast-search-go/0.1 一律放行。

补 UA 断言测试(此前四个测试从未断言过 UA):显式 UA 逐字节发出、空串回落默认、
旧签名仍发默认、timeout<=0 仍回落 30s。已验证注入回归时会红。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-07 11:51:23 +08:00
ansandClaude Fable 5 1d150111ad feat: Charts 与 LoadFeed 支持 context 透传取消
- 新增 ChartsContext / LoadFeedContext(原方法转发 context.Background(),兼容不变)
- Charts 榜单请求与逐项 lookup 全部改 NewRequestWithContext,循环顶检查
  ctx.Err() 提前中止剩余 lookup
- 修复 resp 在 err 检查前解引用(网络错误/ctx 取消时必 panic)
- 修复 lookup 循环 User-Agent 误设在外层请求上

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 02:02:12 +08:00
ans ec79b8b969 set UserAgent for LoadFeed 2025-04-27 17:32:25 +08:00
ans e8316b1d1c add proxy option 2025-04-27 12:16:29 +08:00
ans 4cc6941d95 feat(model): enhance LoadFeed with timeout support and add tests 2025-04-11 17:05:55 +08:00
ans 5fd117b1d1 update LoadFeed 2025-04-09 15:26:25 +08:00
ans 5f0148dab2 fix typo 2025-04-08 22:00:39 +08:00
ans 0e04abf4b8 feat(search): add logging, rate limiting, and genre ID support
Enhance the ITunesProvider by adding logging with detailed caller information, implementing rate limiting to prevent API abuse, and supporting genre IDs for more precise searches. Also, update the User-Agent string and improve error handling and logging throughout the search and charts functionality.
2025-03-30 00:14:24 +08:00
ans bd270a09d0 add GetGenreByLanguage 2025-03-29 21:44:06 +08:00
ans 911086ada0 add Genre 2025-03-29 21:39:00 +08:00
ans 06f1d31abe add Summary field for ApplePodcast 2025-03-29 16:20:28 +08:00
ans 70b8e330cc get all fields from apple podcast 2025-03-28 23:52:46 +08:00
ans fdde34e1f0 generated by Claude-3.7-Sonnet 2025-03-28 22:27:08 +08:00