Skip to main content

概述

Channels 模块提供账号功能,包括搜索账号、关注/取消关注账号。 根据条件搜索账号。
result = client.channels.search(query="Goldman Sachs")
for channel in result.get('channels', []):
    print(f"{channel['name']}: {channel['description']}")
query
str
搜索账号名关键词或者账号链接(现在支持公众号文章链接)
page_num
int
当前页码,默认值为 1
page_size
int
每页条目数,默认值为 10
返回值
dict
包含 page_num, page_size, total_page, total_count, channels 的字典
API 路径POST /v1/channels/search

followings()

获取当前用户关注的账号列表。
result = client.channels.followings()
for channel in result.get('channels', []):
    print(f"{channel['name']} - {channel['id']}")
page_num
int
当前页码,默认值为 1
page_size
int
每页条目数,默认值为 10
返回值
dict
包含 page_num, page_size, total_page, total_count, channels 的字典
API 路径GET /v1/channels/followings

follow()

关注一个账号。
result = client.channels.follow(channel_id="channel_123")
print(f"关注成功: {result}")
channel_id
str
账号 ID
返回值
dict
操作结果
API 路径POST /v1/channels/follow

unfollow()

取消关注一个账号。
result = client.channels.unfollow(channel_id="channel_123")
print(f"取消关注成功: {result}")
channel_id
str
账号 ID
返回值
dict
操作结果
API 路径POST /v1/channels/unfollow

get_docs()

获取关注账号的文档列表。
result = client.channels.get_docs(channel_ids="channel_1,channel_2")
for doc in result.get('docs', []):
    print(f"{doc['title']}: {doc['url']}")
channel_ids
str
账号 ID 列表,用逗号分隔
page_num
int
当前页码,默认值为 1
page_size
int
每页条目数,默认值为 10
返回值
dict
包含 page_num, page_size, total_page, total_count, docs 的字典
API 路径GET /v1/channels/docs