{"id":13467447,"url":"https://github.com/NanmiCoder/MediaCrawler","last_synced_at":"2025-03-26T02:31:26.627Z","repository":{"id":173949473,"uuid":"651517185","full_name":"NanmiCoder/MediaCrawler","owner":"NanmiCoder","description":"小红书笔记 | 评论爬虫、抖音视频 | 评论爬虫、快手视频 | 评论爬虫、B 站视频 ｜ 评论爬虫、微博帖子 ｜ 评论爬虫、百度贴吧帖子 ｜ 百度贴吧评论回复爬虫  | 知乎问答文章｜评论爬虫","archived":false,"fork":false,"pushed_at":"2024-10-28T07:27:13.000Z","size":19660,"stargazers_count":17300,"open_issues_count":22,"forks_count":5439,"subscribers_count":102,"default_branch":"main","last_synced_at":"2024-10-29T15:08:06.521Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://nanmicoder.github.io/MediaCrawler/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NanmiCoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-09T12:14:34.000Z","updated_at":"2024-10-29T13:20:44.000Z","dependencies_parsed_at":"2023-12-03T17:22:13.504Z","dependency_job_id":"eb3a3979-561b-474d-9ff9-a98596b7d878","html_url":"https://github.com/NanmiCoder/MediaCrawler","commit_stats":null,"previous_names":["nanmicoder/mediacrawler"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NanmiCoder%2FMediaCrawler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NanmiCoder%2FMediaCrawler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NanmiCoder%2FMediaCrawler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NanmiCoder%2FMediaCrawler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NanmiCoder","download_url":"https://codeload.github.com/NanmiCoder/MediaCrawler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245495864,"owners_count":20624808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T15:00:56.575Z","updated_at":"2025-03-26T02:31:26.614Z","avatar_url":"https://github.com/NanmiCoder.png","language":"Python","funding_links":[],"categories":["Python","AI拓展工具","Repos","社媒爬虫与竞品分析","Ideation and validation","Social Media Crawlers"],"sub_categories":["Product marketing stack"],"readme":"# 🔥 自媒体平台爬虫🕷️MediaCrawler🔥 \n\u003ca href=\"https://trendshift.io/repositories/8291\" target=\"_blank\"\u003e\u003cimg src=\"https://trendshift.io/api/badge/repositories/8291\" alt=\"NanmiCoder%2FMediaCrawler | Trendshift\" style=\"width: 250px; height: 55px;\" width=\"250\" height=\"55\"/\u003e\u003c/a\u003e\n\n[![GitHub Stars](https://img.shields.io/github/stars/NanmiCoder/MediaCrawler?style=social)](https://github.com/NanmiCoder/MediaCrawler/stargazers)\n[![GitHub Forks](https://img.shields.io/github/forks/NanmiCoder/MediaCrawler?style=social)](https://github.com/NanmiCoder/MediaCrawler/network/members)\n[![GitHub Issues](https://img.shields.io/github/issues/NanmiCoder/MediaCrawler)](https://github.com/NanmiCoder/MediaCrawler/issues)\n[![GitHub Pull Requests](https://img.shields.io/github/issues-pr/NanmiCoder/MediaCrawler)](https://github.com/NanmiCoder/MediaCrawler/pulls)\n[![License](https://img.shields.io/github/license/NanmiCoder/MediaCrawler)](https://github.com/NanmiCoder/MediaCrawler/blob/main/LICENSE)\n\n\u003e **免责声明：**\n\u003e \n\u003e 大家请以学习为目的使用本仓库⚠️⚠️⚠️⚠️，[爬虫违法违规的案件](https://github.com/HiddenStrawberry/Crawler_Illegal_Cases_In_China)  \u003cbr\u003e\n\u003e\n\u003e本仓库的所有内容仅供学习和参考之用，禁止用于商业用途。任何人或组织不得将本仓库的内容用于非法用途或侵犯他人合法权益。本仓库所涉及的爬虫技术仅用于学习和研究，不得用于对其他平台进行大规模爬虫或其他非法行为。对于因使用本仓库内容而引起的任何法律责任，本仓库不承担任何责任。使用本仓库的内容即表示您同意本免责声明的所有条款和条件。\n\u003e\n\u003e 点击查看更为详细的免责声明。[点击跳转](#disclaimer)\n\n# 仓库描述\n\n**小红书爬虫**，**抖音爬虫**， **快手爬虫**， **B站爬虫**， **微博爬虫**，**百度贴吧爬虫**，**知乎爬虫**...。  \n目前能抓取小红书、抖音、快手、B站、微博、贴吧、知乎等平台的公开信息。\n\n原理：利用[playwright](https://playwright.dev/)搭桥，保留登录成功后的上下文浏览器环境，通过执行JS表达式获取一些加密参数\n通过使用此方式，免去了复现核心加密JS代码，逆向难度大大降低\n\n# 功能列表\n| 平台   | 关键词搜索 | 指定帖子ID爬取 | 二级评论 | 指定创作者主页 | 登录态缓存 | IP代理池 | 生成评论词云图 |\n| ------ | ---------- | -------------- | -------- | -------------- | ---------- | -------- | -------------- |\n| 小红书 | ✅          | ✅              | ✅        | ✅              | ✅          | ✅        | ✅              |\n| 抖音   | ✅          | ✅              | ✅        | ✅              | ✅          | ✅        | ✅              |\n| 快手   | ✅          | ✅              | ✅        | ✅              | ✅          | ✅        | ✅              |\n| B 站   | ✅          | ✅              | ✅        | ✅              | ✅          | ✅        | ✅              |\n| 微博   | ✅          | ✅              | ✅        | ✅              | ✅          | ✅        | ✅              |\n| 贴吧   | ✅          | ✅              | ✅        | ✅              | ✅          | ✅        | ✅              |\n| 知乎   | ✅          | ✅              | ✅        | ✅              | ✅          | ✅        | ✅              |\n\n### MediaCrawlerPro重磅发布啦！！！\n\u003e 主打学习成熟项目的架构设计，不仅仅是爬虫，Pro中的其他代码设计思路也是值得学习，欢迎大家关注！！！\n\n[MediaCrawlerPro](https://github.com/MediaCrawlerPro) 版本已经重构出来了，相较于开源版本的优势：\n- 多账号+IP代理支持（重点！）\n- 去除Playwright依赖，使用更加简单\n- 支持linux部署（Docker docker-compose）\n- 代码重构优化，更加易读易维护（解耦JS签名逻辑）\n- 代码质量更高，对于构建更大型的爬虫项目更加友好\n- 完美的架构设计，更加易扩展，源码学习的价值更大\n- Pro中新增全新的自媒体视频下载器桌面端软件（适合学习全栈项目开发）\n\n\n# 安装部署方法\n\u003e 开源不易，希望大家可以Star一下MediaCrawler仓库！！！！十分感谢！！！ \u003cbr\u003e\n\n## 创建并激活 python 虚拟环境\n\u003e 如果是爬取抖音和知乎，需要提前安装nodejs环境，版本大于等于：`16`即可 \u003cbr\u003e\n\u003e 新增 [uv](https://github.com/astral-sh/uv) 来管理项目依赖，使用uv来替代python版本管理、pip进行依赖安装，更加方便快捷\n   ```shell   \n   # 进入项目根目录\n   cd MediaCrawler\n   \n   # 创建虚拟环境\n   # 我的python版本是：3.9.6，requirements.txt中的库是基于这个版本的，如果是其他python版本，可能requirements.txt中的库不兼容，自行解决一下。\n   python -m venv venv\n   \n   # macos \u0026 linux 激活虚拟环境\n   source venv/bin/activate\n\n   # windows 激活虚拟环境\n   venv\\Scripts\\activate\n\n   ```\n\n## 安装依赖库\n\n   ```shell\n   pip install -r requirements.txt\n   ```\n\n## 安装 playwright浏览器驱动\n\n   ```shell\n   playwright install\n   ```\n\n## 运行爬虫程序\n\n   ```shell\n   ### 项目默认是没有开启评论爬取模式，如需评论请在config/base_config.py中的 ENABLE_GET_COMMENTS 变量修改\n   ### 一些其他支持项，也可以在config/base_config.py查看功能，写的有中文注释\n   \n   # 从配置文件中读取关键词搜索相关的帖子并爬取帖子信息与评论\n   python main.py --platform xhs --lt qrcode --type search\n   \n   # 从配置文件中读取指定的帖子ID列表获取指定帖子的信息与评论信息\n   python main.py --platform xhs --lt qrcode --type detail\n  \n   # 打开对应APP扫二维码登录\n     \n   # 其他平台爬虫使用示例，执行下面的命令查看\n   python main.py --help    \n   ```\n\n## 数据保存\n- 支持关系型数据库Mysql中保存（需要提前创建数据库）\n    - 执行 `python db.py` 初始化数据库数据库表结构（只在首次执行）\n- 支持保存到csv中（data/目录下）\n- 支持保存到json中（data/目录下）\n\n\n\n# 其他常见问题可以查看在线文档\n\u003e \n\u003e 在线文档包含使用方法、常见问题、加入项目交流群等。\n\u003e [MediaCrawler在线文档](https://nanmicoder.github.io/MediaCrawler/)\n\u003e \n\n# 作者提供的知识服务\n\u003e 如果想快速入门和学习该项目的使用、源码架构设计等、学习编程技术、亦或者想了解MediaCrawlerPro的源代码设计可以看下我的知识付费栏目。\n\n[作者的知识付费栏目介绍](https://nanmicoder.github.io/MediaCrawler/%E7%9F%A5%E8%AF%86%E4%BB%98%E8%B4%B9%E4%BB%8B%E7%BB%8D.html)\n\n# 项目微信交流群\n\n[加入微信交流群](https://nanmicoder.github.io/MediaCrawler/%E5%BE%AE%E4%BF%A1%E4%BA%A4%E6%B5%81%E7%BE%A4.html)\n  \n# 感谢下列Sponsors对本仓库赞助支持\n- \u003ca href=\"https://sider.ai/ad-land-redirect?source=github\u0026p1=mi\u0026p2=kk\"\u003e【Sider】全网最火的ChatGPT插件，我也免费薅羊毛用了快一年了，体验拉满。\u003c/a\u003e\n\n成为赞助者，可以将您产品展示在这里，每天获得大量曝光，联系作者微信：yzglan 或 email：relakkes@gmail.com\n\n\n# 爬虫入门课程\n我新开的爬虫教程Github仓库 [CrawlerTutorial](https://github.com/NanmiCoder/CrawlerTutorial) ，感兴趣的朋友可以关注一下，持续更新，主打一个免费.\n\n# star 趋势图\n- 如果该项目对你有帮助，帮忙 star一下 ❤️❤️❤️，让更多的人看到MediaCrawler这个项目\n\n[![Star History Chart](https://api.star-history.com/svg?repos=NanmiCoder/MediaCrawler\u0026type=Date)](https://star-history.com/#NanmiCoder/MediaCrawler\u0026Date)\n\n\n# 参考\n\n- xhs客户端 [ReaJason的xhs仓库](https://github.com/ReaJason/xhs)\n- 短信转发 [参考仓库](https://github.com/pppscn/SmsForwarder)\n- 内网穿透工具 [ngrok](https://ngrok.com/docs/)\n\n\n# 免责声明\n\u003cdiv id=\"disclaimer\"\u003e \n\n## 1. 项目目的与性质\n本项目（以下简称“本项目”）是作为一个技术研究与学习工具而创建的，旨在探索和学习网络数据采集技术。本项目专注于自媒体平台的数据爬取技术研究，旨在提供给学习者和研究者作为技术交流之用。\n\n## 2. 法律合规性声明\n本项目开发者（以下简称“开发者”）郑重提醒用户在下载、安装和使用本项目时，严格遵守中华人民共和国相关法律法规，包括但不限于《中华人民共和国网络安全法》、《中华人民共和国反间谍法》等所有适用的国家法律和政策。用户应自行承担一切因使用本项目而可能引起的法律责任。\n\n## 3. 使用目的限制\n本项目严禁用于任何非法目的或非学习、非研究的商业行为。本项目不得用于任何形式的非法侵入他人计算机系统，不得用于任何侵犯他人知识产权或其他合法权益的行为。用户应保证其使用本项目的目的纯属个人学习和技术研究，不得用于任何形式的非法活动。\n\n## 4. 免责声明\n开发者已尽最大努力确保本项目的正当性及安全性，但不对用户使用本项目可能引起的任何形式的直接或间接损失承担责任。包括但不限于由于使用本项目而导致的任何数据丢失、设备损坏、法律诉讼等。\n\n## 5. 知识产权声明\n本项目的知识产权归开发者所有。本项目受到著作权法和国际著作权条约以及其他知识产权法律和条约的保护。用户在遵守本声明及相关法律法规的前提下，可以下载和使用本项目。\n\n## 6. 最终解释权\n关于本项目的最终解释权归开发者所有。开发者保留随时更改或更新本免责声明的权利，恕不另行通知。\n\u003c/div\u003e\n\n\n## 感谢JetBrains提供的免费开源许可证支持\n\u003ca href=\"https://www.jetbrains.com/?from=MediaCrawler\"\u003e\n    \u003cimg src=\"https://www.jetbrains.com/company/brand/img/jetbrains_logo.png\" width=\"100\" alt=\"JetBrains\" /\u003e\n\u003c/a\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNanmiCoder%2FMediaCrawler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNanmiCoder%2FMediaCrawler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNanmiCoder%2FMediaCrawler/lists"}