{"id":31465554,"url":"https://github.com/whateverzpy/douban_comments","last_synced_at":"2025-10-01T17:48:10.527Z","repository":{"id":314592214,"uuid":"1056084359","full_name":"whateverzpy/douban_comments","owner":"whateverzpy","description":"HITSZ 2025 秋季的大数据导论课程作业内容","archived":false,"fork":false,"pushed_at":"2025-09-13T12:41:46.000Z","size":56,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-13T13:48:16.719Z","etag":null,"topics":["bigdata","crawler","scrapy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/whateverzpy.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-13T11:02:00.000Z","updated_at":"2025-09-13T12:43:55.000Z","dependencies_parsed_at":"2025-09-13T13:48:18.391Z","dependency_job_id":"7f507039-86a6-4c86-85c4-851b13ab9da8","html_url":"https://github.com/whateverzpy/douban_comments","commit_stats":null,"previous_names":["whateverzpy/douban_comments"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/whateverzpy/douban_comments","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whateverzpy%2Fdouban_comments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whateverzpy%2Fdouban_comments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whateverzpy%2Fdouban_comments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whateverzpy%2Fdouban_comments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whateverzpy","download_url":"https://codeload.github.com/whateverzpy/douban_comments/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whateverzpy%2Fdouban_comments/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277883509,"owners_count":25894165,"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","status":"online","status_checked_at":"2025-10-01T02:00:09.286Z","response_time":88,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bigdata","crawler","scrapy"],"created_at":"2025-10-01T17:48:09.070Z","updated_at":"2025-10-01T17:48:10.522Z","avatar_url":"https://github.com/whateverzpy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# douban_comments\n\n记录大数据导论课的作业内容。\n\n## 项目简介\n\n本项目基于 Scrapy 框架，用于爬取豆瓣电影的短评数据，并将其保存为 JSON 文件。适合数据分析、文本挖掘等用途。\n\n## 目录结构\n\n- comments.json：爬取结果示例\n- douban_comments/：Scrapy 项目主目录\n    - items.py：定义爬取的数据结构\n    - middlewares.py：中间件配置\n    - pipelines.py：数据处理管道\n    - settings.py：Scrapy 配置\n    - spiders/comments.py：爬虫主文件\n\n## 安装方法\n\n1. 克隆项目\n\n```bash\ngit clone https://github.com/yourusername/douban_comments.git\ncd douban_comments\n```\n\n2. 安装依赖\n\n```bash\npip install pipenv\npipenv install\n```\n\n## 使用方法\n\n1. 进入虚拟环境\n\n```bash\npipenv shell\n```\n\n2. 使用自己的账号登录豆瓣，获取 cookies，将对应项填入 `.env.example` 文件，重命名为 `.env`\n3. 运行爬虫\n\n```bash\nscrapy crawl comments\n```\n\n4. 爬取结果将保存在 `comments.json` 文件中。\n\n## 注意事项\n\n- 爬取数据请遵守豆瓣相关政策，仅供学习和研究使用。\n- ~~用了几次就被封 ip 了~~\n\n## TODO\n\n- 我们需要更强有力的反反爬虫机制\n\n## 代码说明\n\n- `items.py`：定义了爬取的电影短评数据结构（如电影名、评论内容、用户等字段）。\n- `middlewares.py`：配置了请求和响应的中间件，可用于处理反爬虫、请求头等。\n- `pipelines.py`：实现了数据的后续处理和保存逻辑，比如将爬取结果写入 JSON 文件。\n- `settings.py`：包含 Scrapy 项目的全局配置，如并发数、请求延迟、Cookies 设置等。\n- `spiders/comments.py`：爬虫的主逻辑，负责先爬取电影列表，再逐个爬取每部电影的短评。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhateverzpy%2Fdouban_comments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhateverzpy%2Fdouban_comments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhateverzpy%2Fdouban_comments/lists"}