MediaCrawler

MediaCrawler

社交媒体数据爬虫工具 支持多平台内容采集

MediaCrawler是一款开源的社交媒体数据爬虫工具,支持小红书、抖音、快手等多个主流平台。该工具可采集视频、图片、评论等内容,提供关键词搜索、指定ID爬取等功能。项目采用Playwright技术简化逆向过程,并集成了登录态缓存、IP代理等实用特性。MediaCrawler为社交媒体数据分析提供了便捷的数据采集解决方案。

爬虫数据采集社交媒体Playwright自动化Github开源项目

免责声明:

请以学习为目的使用本仓库,爬虫违法违规案例:https://github.com/HiddenStrawberry/Crawler_Illegal_Cases_In_China <br>

本仓库的所有内容仅供学习和参考之用,禁止用于商业用途。任何人或组织不得将本仓库的内容用于非法用途或侵犯他人合法权益。本仓库所涉及的爬虫技术仅用于学习和研究,不得用于对其他平台进行大规模爬虫或其他非法行为。对于因使用本仓库内容而引起的任何法律责任,本仓库不承担任何责任。使用本仓库的内容即表示您同意本免责声明的所有条款和条件。

点击查看更为详细的免责声明。点击跳转

仓库描述

小红书爬虫抖音爬虫快手爬虫B站爬虫微博爬虫百度贴吧...。 目前能抓取小红书、抖音、快手、B站、微博的视频、图片、评论、点赞、转发等信息。

原理:利用playwright搭桥,保留登录成功后的上下文浏览器环境,通过执行JS表达式获取一些加密参数。 通过使用此方式,免去了复现核心加密JS代码,逆向难度大大降低。

MediaCrawlerPro版本经过2个周的通宵,已经迭代出来了,相较于现在有一些优势:

  • 多账号+IP代理支持(重点!)
  • 去除Playwright依赖,使用更加简单
  • 支持linux部署(Docker docker-compose)
  • 代码重构优化,更加易读易维护

功能列表

平台关键词搜索指定帖子ID爬取二级评论指定创作者主页登录态缓存IP代理池生成评论词云图
小红书
抖音
快手
B 站
微博
贴吧

使用方法

创建并激活 python 虚拟环境

# 进入项目根目录 cd MediaCrawler # 创建虚拟环境 # 注意python 版本需要3.7 - 3.9 高于该版本可能会出现一些依赖包兼容问题 python -m venv venv # macos & linux 激活虚拟环境 source venv/bin/activate # windows 激活虚拟环境 venv\Scripts\activate

安装依赖库

pip install -r requirements.txt

安装 playwright浏览器驱动

playwright install

运行爬虫程序

### 项目默认是没有开启评论爬取模式,如需评论请在config/base_config.py中的 ENABLE_GET_COMMENTS 变量修改 ### 一些其他支持项,也可以在config/base_config.py查看功能,写的有中文注释 # 从配置文件中读取关键词搜索相关的帖子并爬取帖子信息与评论 python main.py --platform xhs --lt qrcode --type search # 从配置文件中读取指定的帖子ID列表获取指定帖子的信息与评论信息 python main.py --platform xhs --lt qrcode --type detail # 打开对应APP扫二维码登录 # 其他平台爬虫使用示例,执行下面的命令查看 python main.py --help

数据保存

  • 支持保存到关系型数据库(Mysql、PgSQL等)
    • 执行 python db.py 初始化数据库数据库表结构(只在首次执行)
  • 支持保存到csv中(data/目录下)
  • 支持保存到json中(data/目录下)

加入MediaCrawler爬虫项目交流群。点击跳转加入

开发者服务

Thanks to the following Sponsors for supporting this repository

  • <a href="https://www.kuaidaili.com/?ref=ldwkjqipvz6c">【Fast Proxy】Enterprise-level proxy IP service, fast and stable, safe and reliable. The best choice for crawler engineers.</a> <a href="https://www.kuaidaili.com/?ref=ldwkjqipvz6c" target="_blank"><img src="https://yellow-cdn.veclightyear.com/835a84d5/03be7c84-9006-43a0-8e29-5ee492cb15b4.png" alt="【Fast Proxy】Enterprise-level proxy IP service, fast and stable, safe and reliable. The best choice for crawler engineers."></a><br>

  • <a href="https://sider.ai/ad-land-redirect?source=github&p1=mi&p2=kk">Sider, the most popular ChatGPT plugin on the internet. I've been using it for free for almost a year, and the experience is excellent.</a>

Become a sponsor and showcase your product here to gain daily exposure. Contact the author on WeChat: yzglan

Donations

If you find this project helpful, you can make a donation. Your support is my greatest motivation!

When making a donation, you can leave a note with your name, and I will add you to the donation list.

<p> <img alt="Donation-WeChat" src="https://yellow-cdn.veclightyear.com/835a84d5/84204761-afd6-40d9-8d39-856987c827fd.jpeg" style="width: 200px;margin-right: 140px;" /> <img alt="Donation-Alipay" src="https://yellow-cdn.veclightyear.com/835a84d5/3f55e6f7-e497-445c-bc76-d913f893162a.png" style="width: 200px" /> </p>

View donation list Click to jump

MediaCrawler Crawler Project Discussion Group:

<div id="join_wechat_group">

Scan my personal WeChat QR code below and note "github" to be added to the MediaCrawler project discussion group (please make sure to note "github", a WeChat assistant will automatically add you to the group)

If the image doesn't display, you can directly add my WeChat ID: yzglan

<div style="max-width: 200px"> <p><img alt="relakkes_wechat" src="https://yellow-cdn.veclightyear.com/835a84d5/6f6f23d2-95d1-4872-be4c-0801bfb76921.JPG" style="width: 200px;height: 100%" ></p> </div> </div>

Common Q&A for Runtime Errors

Try to search and solve problems on your own first. AI is very popular now, and ChatGPT can solve most of your problems in many cases Free ChatGPT

➡️➡️➡️ Common Issues

Douyin and Xiaohongshu now use Playwright for login, which will have slider verification + SMS verification. Please manually complete this process.

Project Code Structure

➡️➡️➡️ Project Code Structure Description

Proxy IP Usage Instructions

➡️➡️➡️ Proxy Usage Instructions

Word Cloud Related Operation Instructions

➡️➡️➡️ Word Cloud Related Instructions

Mobile Number Login Instructions

➡️➡️➡️ Mobile Number Login Instructions

Crawler Beginner Course

I've started a new crawler tutorial Github repository CrawlerTutorial. Interested friends can follow it. It's continuously updated and completely free.

项目贡献者

感谢你们的贡献,让项目变得更好!(贡献比较多的可以加我微信,免费拉你进我的知识星球,后期还有一些其他福利。)

<!-- readme: contributors -start --> <table> <tbody> <tr> <td align="center"> <a href="https://github.com/NanmiCoder"> <img src="https://avatars.githubusercontent.com/u/47178017?v=4" width="100;" alt="NanmiCoder"/> <br /> <sub><b>程序员阿江-Relakkes</b></sub> </a> </td> <td align="center"> <a href="https://github.com/leantli"> <img src="https://avatars.githubusercontent.com/u/117699758?v=4" width="100;" alt="leantli"/> <br /> <sub><b>leantli</b></sub> </a> </td> <td align="center"> <a href="https://github.com/Rosyrain"> <img src="https://avatars.githubusercontent.com/u/116946548?v=4" width="100;" alt="Rosyrain"/> <br /> <sub><b>Rosyrain</b></sub> </a> </td> <td align="center"> <a href="https://github.com/BaoZhuhan"> <img src="https://avatars.githubusercontent.com/u/140676370?v=4" width="100;" alt="BaoZhuhan"/> <br /> <sub><b>包诸涵</b></sub> </a> </td> <td align="center"> <a href="https://github.com/nelzomal"> <img src="https://avatars.githubusercontent.com/u/8512926?v=4" width="100;" alt="nelzomal"/> <br /> <sub><b>周楠</b></sub> </a> </td> <td align="center"> <a href="https://github.com/helloteemo"> <img src="https://avatars.githubusercontent.com/u/46838719?v=4" width="100;" alt="helloteemo"/> <br /> <sub><b>helloteemo</b></sub> </a> </td> </tr> <tr> <td align="center"> <a href="https://github.com/Ermeng98"> <img src="https://avatars.githubusercontent.com/u/55784769?v=4" width="100;" alt="Ermeng98"/> <br /> <sub><b>二梦</b></sub> </a> </td> <td align="center"> <a href="https://github.com/PeanutSplash"> <img src="https://avatars.githubusercontent.com/u/98582625?v=4" width="100;" alt="PeanutSplash"/> <br /> <sub><b>花生溅射</b></sub> </a> </td> <td align="center"> <a href="https://github.com/Hiro-Lin"> <img src="https://avatars.githubusercontent.com/u/40111864?v=4" width="100;" alt="Hiro-Lin"/> <br /> <sub><b>HIRO</b></sub> </a> </td> <td align="center"> <a href="https://github.com/henryhyn"> <img src="https://avatars.githubusercontent.com/u/5162443?v=4" width="100;" alt="henryhyn"/> <br /> <sub><b>亨利 何</b></sub> </a> </td> <td align="center"> <a href="https://github.com/Akiqqqqqqq"> <img src="https://avatars.githubusercontent.com/u/51102894?v=4" width="100;" alt="Akiqqqqqqq"/> <br /> <sub><b>leonardoqiuyu</b></sub> </a> </td> <td align="center"> <a href="https://github.com/jayeeliu"> <img src="https://avatars.githubusercontent.com/u/77389?v=4" width="100;" alt="jayeeliu"/> <br /> <sub><b>jayeeliu</b></sub> </a> </td> </tr> <tr> <td align="center"> <a href="https://github.com/fruitswordman"> <img src="https://avatars.githubusercontent.com/u/103844614?v=4" width="100;" alt="fruitswordman"/> <br /> <sub><b>吕文博</b></sub> </a> </td> <td align="center"> <a href="https://github.com/ZhouXsh"> <img src="https://avatars.githubusercontent.com/u/131248181?v=4" width="100;" alt="ZhouXsh"/> <br /> <sub><b>ZhouXsh</b></sub> </a> </td> <td align="center"> <a href="https://github.com/ZuWard"> <img src="https://avatars.githubusercontent.com/u/38209256?v=4" width="100;" alt="ZuWard"/> <br /> <sub><b>ZuWard</b></sub> </a> </td> <td align="center"> <a href="https://github.com/Zzendrix"> <img src="https://avatars.githubusercontent.com/u/154900254?v=4" width="100;" alt="Zzendrix"/> <br /> <sub><b>Zendrix</b></sub> </a> </td> <td align="center"> <a href="https://github.com/chunpat"> <img src="https://avatars.githubusercontent.com/u/19848304?v=4" width="100;" alt="chunpat"/> <br /> <sub><b>张振鹏</b></sub> </a> </td> <td align="center"> <a href="https://github.com/tanpenggood"> <img src="https://avatars.githubusercontent.com/u/37927946?v=4" width="100;" alt="tanpenggood"/> <br /> <sub><b>谭鹏</b></sub> </a> </td> </tr> <tr> <td align="center"> <a href="https://github.com/xbsheng"> <img src="https://avatars.githubusercontent.com/u/56357338?v=4" width="100;" alt="xbsheng"/> <br /> <sub><b>xbsheng</b></sub> </a> </td> <td align="center"> <a href="https://github.com/yangrq1018"> <img src="https://avatars.githubusercontent.com/u/25074163?v=4" width="100;" alt="yangrq1018"/> <br /> <sub><b>马丁</b></sub> </a> </td> <td align="center"> <a href="https://github.com/zhihuiio"> <img src="https://avatars.githubusercontent.com/u/165655688?v=4" width="100;" alt="zhihuiio"/> <br /> <sub><b>zhihuiio</b></sub> </a> </td> <td align="center"> <a href="https://github.com/renaissancezyc"> <img src="https://avatars.githubusercontent.com/u/118403818?v=4" width="100;" alt="renaissancezyc"/> <br /> <sub><b>任</b></sub> </a> </td> <td align="center"> <a href="https://github.com/Tianci-King"> <img src="https://avatars.githubusercontent.com/u/109196852?v=4" width="100;" alt="Tianci-King"/> <br /> <sub><b>王天赐</b></sub> </a> </td> <td align="center"> <a href="https://github.com/Styunlen"> <img src="https://avatars.githubusercontent.com/u/30810222?v=4" width="100;" alt="Styunlen"/> <br /> <sub><b>Styunlen</b></sub> </a> </td> </tr> <tr> <td align="center"> <a href="https://github.com/Schofi"> <img src="https://avatars.githubusercontent.com/u/33537727?v=4" width="100;" alt="Schofi"/> <br /> <sub><b>Schofi</b></sub> </a> </td> <td align="center"> <a href="https://github.com/Klu5ure"> <img src="https://avatars.githubusercontent.com/u/166240879?v=4" width="100;" alt="Klu5ure"/> <br /> <sub><b>Klu5ure</b></sub> </a> </td> <td align="center"> <a href="https://github.com/keeper-jie"> <img src="https://avatars.githubusercontent.com/u/33612777?v=4" width="100;" alt="keeper-jie"/> <br /> <sub><b>科米特</b></sub> </a> </td> <td align="center"> <a href="https://github.com/kexinoh"> <img src="https://avatars.githubusercontent.com/u/91727108?v=4" width="100;" alt="kexinoh"/> <br /> <sub><b>KEXNA</b></sub> </a> </td> <td align="center"> <a href="https://github.com/aa65535"> <img src="https://avatars.githubusercontent.com/u/5417786?v=4" width="100;" alt="aa65535"/> <br /> <sub><b>张健</b></sub> </a> </td> <td align="center"> <a href="https://github.com/Jasonyang2014"> <img src="https://avatars.githubusercontent.com/u/8269290?v=4" width="100;" alt="Jasonyang2014"/> <br /> <sub><b>欧阳</b></sub> </a> </td> </tr> <tr> <td align="center"> <a href="https://github.com/522109452"> <img src="https://avatars.githubusercontent.com/u/16929874?v=4" width="100;" alt="522109452"/> <br /> <sub><b>天青</b></sub> </a> </td> <td align="center"> <a href="https://github.com/3DRX"> <img src="https://avatars.githubusercontent.com/u/67278980?v=4" width="100;" alt="3DRX"/> <br /> <sub><b>康景阳</b></sub> </a> </td> </tr> </tbody> </table> ## star 趋势图 - 如果该项目对你有帮助,请给个 star ❤️❤️❤️

Star 历史图表

参考

捐赠信息

<div id="donate">

注:打赏时请备注捐赠者姓名,如有遗漏请联系我添加(有时消息较多可能会遗漏,十分抱歉)

捐赠者捐赠金额捐赠日期
*皓50 元2024-03-18
*刚50 元2024-03-18
*乐20 元2024-03-17
*木20 元2024-03-17
*诚20 元2024-03-17
Strem Gamer20 元2024-03-16
*鑫20 元2024-03-14
Yuzu20 元2024-03-07
**宁100 元2024-03-03
**媛20 元2024-03-03
Scarlett20 元2024-02-16
Asun20 元2024-01-30
何*100 元2024-01-21
allen20 元2024-01-10
llllll20 元2024-01-07
邝*元20 元2023-12-29
50chen50 元2023-12-22
xiongot20 元2023-12-17
atom.hu20 元2023-12-16
一呆20 元2023-12-01
坠落50 元2023-11-08
</div>

免责声明

<div id="disclaimer">

1. 项目目的与性质

本项目(以下简称"本项目")是作为一个技术研究与学习工具而创建的,旨在探索和学习网络数据采集技术。本项目专注于自媒体平台的数据爬取技术研究,旨在提供给学习者和研究者作为技术交流之用。

2. 法律合规性声明

本项目开发者(以下简称"开发者")郑重提醒用户在下载、安装和使用本项目时,严格遵守中华人民共和国相关法律法规,包括但不限于《中华人民共和国网络安全法》、《中华人民共和国反间谍法》等所有适用的国家法律和政策。用户应自行承担一切因使用本项目而可能引起的法律责任。

3. 使用目的限制

本项目严禁用于任何非法目的或非学习、非研究的商业行为。本项目不得用于任何形式的非法侵入他人计算机系统,不得用于任何侵犯他人知识产权或其他合法权益的行为。用户应保证其使用本项目的目的纯属个人学习和技术研究,不得用于任何形式的非法活动。

4. 免责声明

开发者已尽最大努力确保本项目的正当性及安全性,但不对用户使用本项目可能引起的任何形式的直接或间接损失承担责任。包括但不限于由于使用本项目而导致的任何数据丢失、设备损坏、法律诉讼等。

5. 知识产权声明

本项目的知识产权归开发者所有。本项目受到著作权法和国际著作权条约以及其他知识产权法律和条约的保护。用户在遵守本声明及相关法律法规的前提下,可以下载和使用本项目。

6. 最终解释权

关于本项目的最终解释权归开发者所有。开发者保留随时更改或更新本免责声明的权利,恕不另行通知。

</div>

感谢JetBrains提供的免费开源许可证支持

<a href="https://www.jetbrains.com/?from=MediaCrawler"> <img src="https://yellow-cdn.veclightyear.com/835a84d5/b718b52d-3fbb-4f63-b614-932d69395d78.png" width="100" alt="JetBrains" /> </a>

编辑推荐精选

讯飞智文

讯飞智文

一键生成PPT和Word,让学习生活更轻松

讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。

AI办公办公工具AI工具讯飞智文AI在线生成PPTAI撰写助手多语种文档生成AI自动配图热门
讯飞星火

讯飞星火

深度推理能力全新升级,全面对标OpenAI o1

科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。

热门AI开发模型训练AI工具讯飞星火大模型智能问答内容创作多语种支持智慧生活
Spark-TTS

Spark-TTS

一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型

Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。

Trae

Trae

字节跳动发布的AI编程神器IDE

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

AI工具TraeAI IDE协作生产力转型热门
咔片PPT

咔片PPT

AI助力,做PPT更简单!

咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

热门AI辅助写作AI工具讯飞绘文内容运营AI创作个性化文章多平台分发AI助手
材料星

材料星

专业的AI公文写作平台,公文写作神器

AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。

openai-agents-python

openai-agents-python

OpenAI Agents SDK,助力开发者便捷使用 OpenAI 相关功能。

openai-agents-python 是 OpenAI 推出的一款强大 Python SDK,它为开发者提供了与 OpenAI 模型交互的高效工具,支持工具调用、结果处理、追踪等功能,涵盖多种应用场景,如研究助手、财务研究等,能显著提升开发效率,让开发者更轻松地利用 OpenAI 的技术优势。

Hunyuan3D-2

Hunyuan3D-2

高分辨率纹理 3D 资产生成

Hunyuan3D-2 是腾讯开发的用于 3D 资产生成的强大工具,支持从文本描述、单张图片或多视角图片生成 3D 模型,具备快速形状生成能力,可生成带纹理的高质量 3D 模型,适用于多个领域,为 3D 创作提供了高效解决方案。

3FS

3FS

一个具备存储、管理和客户端操作等多种功能的分布式文件系统相关项目。

3FS 是一个功能强大的分布式文件系统项目,涵盖了存储引擎、元数据管理、客户端工具等多个模块。它支持多种文件操作,如创建文件和目录、设置布局等,同时具备高效的事件循环、节点选择和协程池管理等特性。适用于需要大规模数据存储和管理的场景,能够提高系统的性能和可靠性,是分布式存储领域的优质解决方案。

下拉加载更多