Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
异步调用 Pixiv API
此项目的开发者很忙,所以没啥时间修 bug ,写文档什么的
使用 pip
pip install --upgrade async-pixiv
# 安装额外依赖(用于提升数据解析速度)
pip install --upgrade async-pixiv[speedups]
from async_pixiv import PixivClient # 导入
from async_pixiv.utils.rate_limiter import RateLimiter
# 初始化 Client
client = PixivClient(
limiter=RateLimiter(100, 60), # API 请求速率限制, 限制为 60 秒内最多请求 100 次。默认没有限制
timeout=10, # 默认超时秒数
proxy=None, # 代理配置
trust_env=False, # 是否从环境变量中获取代理配置
retry_times=5, # 默认请求重试次数
retry_sleep=1, # 默认重复请求间隔秒数
)
async def main():
user = await client.login_with_token('TOKEN') # 使用 token 登录 pixiv
print(user.name)
# 获取作品详情
detail_result = await client.ILLUST.detail(91725675)
illust = detail_result.illust
print(
f"链接:{illust.link}",
f"标题:{illust.title}",
f"作者:{illust.user.name}",
f"标签:#{' #'.join(map(str, illust.tags))}",
f"是否为 AI 作品:{'是' if illust.ai_type else '否'}",
f"是否为 R18 作品:{'是' if await illust.is_r18() else '否'}",
sep='\n'
)
file_data = illust.link.download() # 下载
breakpoint()
# 下载动图
bytes_data = await illust.download_ugoira(result_type='mp4') # bytes
gif_data = await illust.download_ugoira(result_type='gif')
breakpoint()
# 小说
novel_result = await client.NOVEL.detail(15739859)
novel = novel_result.novel
print(f"标题:{novel.title}", f"字数:{novel.text_length}", sep='\n')
breakpoint()
# 漫画
# 下次再写
def __main__():
import asyncio
asyncio.run(main())
if __name__ == '__main__':
__main__()
FAQs
Async Pixiv API for Python.
We found that async-pixiv demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.