# 腾讯新闻 **Repository Path**: onemonth/tencent_news ## Basic Information - **Project Name**: 腾讯新闻 - **Description**: 腾讯热点新闻 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-07-06 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 腾讯新闻 #### 介绍 1. 腾讯热点新闻 2. 面试项目,请勿用于商用 #### 项目说明 1. 找到新闻API,返回json格式,从其取出详情页的url和有用信息 2. 翻页通过使用re.sub()替换即可 3. 判断键名data是否为空列表,如果是则说明已经爬到最后一页,就不在翻页 4. 详情页有些是视频或者一些别的新闻列表,通过判断内容的class是否为None,如果为None,则不存储该条新闻 5. 添加filter_id字段判断数据库中是否已经存在该条新闻,避免多次重复访问,使用request_fingerprint生成该字段 5. 最后将爬取到的数据保存到mongodb中,如图 ![](QQ截图20200706181800.png) #### 使用说明 1. 命令行输入`scrapy crawl tengxun` #### 码云特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)