贴吧帖子爬虫 - 把百度贴吧帖子连图片带回复全扒下来
Crawl Tieba threads with full content, images, and sub-posts to Markdown.
bash
# 帖子链接或 ID
python3 tieba_spider.py "https://tieba.baidu.com/p/7487460366"
python3 tieba_spider.py "7487460366"
# 指定输出目录
python3 tieba_spider.py "7487460366" --output ~/downloads
# 不下载图片
python3 tieba_spider.py "7487460366" --no-images
参数说明Description帖子帖子链接或纯数字 IDThread URL or ID--output/-o输出目录 (默认: 当前目录)Output directory--no-images不下载图片Skip image download--delay/-d请求间隔秒数 (默认: 0.5)Request delay
text
{帖子ID}_{标题}/
├── {标题}.md # 帖子内容 Markdown
└── images/ # 下载的图片
bash
python3 tieba_spider.py 7487460366 --output ./output
输出文件会保存在 ./output/7487460366_xxx/ 目录。
使用百度贴吧移动端 API,无需登录即可抓取。内置 0.5 秒延迟防止请求过快。