feature: 支持小红书图片、视频下载

This commit is contained in:
helloteemo
2024-07-11 22:49:05 +08:00
parent 1a776ee968
commit 6545a15ff3
5 changed files with 153 additions and 6 deletions

View File

@@ -129,6 +129,15 @@ class XiaoHongShuClient(AbstractApiClient):
return await self.request(method="POST", url=f"{self._host}{uri}",
data=json_str, headers=headers)
async def get_note_media(self, url: str) -> bytes | None:
async with httpx.AsyncClient(proxies=self.proxies) as client:
response = await client.request("GET", url, timeout=self.timeout)
if not response.reason_phrase == "OK":
utils.logger.error(f"[XiaoHongShuClient.get_note_media] request {url} err, res:{response.text}")
return None
else:
return response.content
async def pong(self) -> bool:
"""
用于检查登录态是否失效了