{"id":22775174,"url":"https://github.com/viper373/jd-comments","last_synced_at":"2025-04-15T09:53:37.289Z","repository":{"id":235205822,"uuid":"790288889","full_name":"Viper373/JD-comments","owner":"Viper373","description":"爬取京东商品评论数据","archived":false,"fork":false,"pushed_at":"2024-08-21T02:32:17.000Z","size":3384,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"1.0","last_synced_at":"2025-03-28T19:07:40.515Z","etag":null,"topics":["crawler-python","data-analysis","python","spider"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/Viper373.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":"2024-04-22T15:56:50.000Z","updated_at":"2025-01-14T07:26:42.000Z","dependencies_parsed_at":"2024-08-21T03:54:39.964Z","dependency_job_id":null,"html_url":"https://github.com/Viper373/JD-comments","commit_stats":null,"previous_names":["viper373/jd_comments","viper373/jd-comments"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Viper373%2FJD-comments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Viper373%2FJD-comments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Viper373%2FJD-comments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Viper373%2FJD-comments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Viper373","download_url":"https://codeload.github.com/Viper373/JD-comments/tar.gz/refs/heads/1.0","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249048715,"owners_count":21204306,"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":["crawler-python","data-analysis","python","spider"],"created_at":"2024-12-11T18:26:17.974Z","updated_at":"2025-04-15T09:53:37.284Z","avatar_url":"https://github.com/Viper373.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003epython爬取京东商品评论数据\u003c/h1\u003e\n\n\u003e 作者：Nong-Yi（本人属于借鉴并改进，如有侵权请联系删除，谢谢）\n\u003e\n\u003e 版本：1.1.0\n\u003e\n\u003e 版权：©️Nong-Yi（以下内容为原作者原创，转载请注明出处）\n\n## 改进（所有更新内容均在原作者基础上增加）\n- ✅增加了随机UA头，构建了Cookie池(jd_cookies.py)，为爬取多种商品做好防风控\n- ✅增加了data目录，用于存储爬取到的数据\n- ✅将每一条评论构建为字典，append到列表中，最后将列表写入CSV文件\n- ❗❗（特别注意）经本人多次测试，最终爬取的单个商品评论数据中有重复部分，建议使用drop_duplicates()去重，不知道的可自行百度，非常简单\n- ❗❗（特别注意）cookie不稳定，容易过期或被服务器拒绝，导致报KeyError：'maxPage'错误。最好不要让cookie池中的账号退出登录，也可人工点击页面的“商品评价”处，手动过服务器的验证（旋转验证码）\n- ❗❗（特别注意）单个商品规格的评论可能会报KeyError：'comments'错误，目前暂未解决\n- 🚩TODO: \n  - 1、增加代理池\n  - 2、优化各个函数，重写变量的命名\n  - 3、使用rich库代替tqdm模块\n\n\u003ch2\u003e模块\u003c/h2\u003e\n\u003cp\u003e模块使用了re、httpx这些库\u003c/p\u003e\n\u003cp\u003ehttpx模块是一个可以发送网络请求的模块,与requests库相似但有一个requests库没有的功能,就是httpx可以发送http2协议的请求\u003c/p\u003e\n\u003cp\u003ere库是一个正则表达式的一个工具\u003c/p\u003e\n\u003cp\u003e关于这两个库大家可以去官网了解我就不过多介绍了\u003c/p\u003e\n\n\u003cpre\u003e# 安装方式(安装了可以跳过):\npip install httpx\n# 上面安装的httpx没办法使用http2请求我们还需要继续安装下面这个\npip install httpx[http2]\n# 这样就可以使用http2协议进行请求了\npip install re\u003c/pre\u003e\n\n\u003ch3\u003e作者的网站地址：www.nong-yi.cn\u003c/h3\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviper373%2Fjd-comments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fviper373%2Fjd-comments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviper373%2Fjd-comments/lists"}