当前位置: 首页 > news >正文

wordpress用户站点网页游戏平台51

wordpress用户站点,网页游戏平台51,wordpress加百度商桥变慢,中国机械加工网官网址一.最终效果 二.项目代码 2.1 新建项目 本文使用scrapy分布式、多线程爬虫框架编写的高性能爬虫#xff0c;因此新建、运行scrapy项目3步骤#xff1a; 1.新建项目: scrapy startproject weibo_hot 2.新建 spider: scrapy genspider hot_search weibo.com 3…一.最终效果 二.项目代码 2.1 新建项目 本文使用scrapy分布式、多线程爬虫框架编写的高性能爬虫因此新建、运行scrapy项目3步骤 1.新建项目: scrapy startproject weibo_hot 2.新建 spider: scrapy genspider hot_search weibo.com 3.运行 spider: scrapy crawl hot_search 注意hot_search 是spider中的name 4.编写item class WeiboHotItem(scrapy.Item):index scrapy.Field()topic_flag scrapy.Field()icon_desc_color scrapy.Field()small_icon_desc scrapy.Field()small_icon_desc_color scrapy.Field()is_hot scrapy.Field()is_gov scrapy.Field()note scrapy.Field()mid scrapy.Field()url scrapy.Field()flag scrapy.Field()name scrapy.Field()word scrapy.Field()pos scrapy.Field()icon_desc scrapy.Field() 5.编写爬虫解析代码 import os from itemadapter import ItemAdapter from .settings import DATA_URI from .Utils import Tooltool Tool()class WeiboHotPipeline:def open_spider(self, spider):self.hot_line index,mid,word,label_name,raw_hot,category,onboard_time\ndata_dir os.path.join(DATA_URI)file_path data_dir /hot.csv#判断文件夹存放的位置是否存在不存在则新建文件夹if os.path.isfile(file_path):self.data_file open(file_path, a, encodingutf-8)else:if not os.path.exists(data_dir):os.makedirs(data_dir)self.data_file open(file_path, a, encodingutf-8)self.data_file.write(self.hot_line)def close_spider(self, spider): # 在关闭一个spider的时候自动运行self.data_file.close()def process_item(self, item, spider):try:hot_line {},{},{},{},{},{},{}\n.format(item.get(index, ),item.get(mid, ),item.get(word, ),item.get(label_name, ),item.get(raw_hot, ),tool.translate_chars(item.get(category, )),tool.get_format_time(item.get(onboard_time, )),)self.data_file.write(hot_line)except BaseException as e:print(hot错误在这里, e, 错误在这里)return item 三.注意事项 settings.py配置项修改 # Obey robots.txt rules ROBOTSTXT_OBEY False # 关闭否则根据weibo的爬虫策略爬虫无法获取数据 如果 四.运行过程 五.项目说明文档 六.获取完整源码 爱学习的小伙伴本次案例的完整源码已上传微信公众号“一个努力奔跑的snail”后台回复 热搜榜 即可获取。
http://www.dnsts.com.cn/news/171299.html

相关文章:

  • 西安网站建设地址百度云网盘登录入口
  • aspcms 网站无法显示该页面aso优化是什么
  • 网站开发怎样建立后台数据wordpress编辑器添加字体大小
  • 园区网站建设方案广州海珠区有什么好玩的景点
  • 织梦网站模板做的网站有哪些it从零开始学大概要学多久
  • 中国招标机构哪个网站做的好做建网站的工作一年赚几百万
  • 企业响应网站seo数据
  • 加盟营销型网站制作网站黄金比例
  • 北京+网站建设个人网站首页设计欣赏
  • 做社交网站需要什么资质品牌推广的概念
  • 乐清网站制作的公司深圳做外贸网站的公司
  • 网站建设论坛排名做音乐下载网站
  • site网站连通率0%怎么解决网站开发经理岗位职责
  • 金泉网做网站南京华佑千家装饰工程有限公司
  • 网站域名自动跳转推广引流哪个软件最好
  • 网站seo策划方案案例分析免费咨询会计问题
  • 如何建自己的网站电子商务网站建设合同签订
  • 保障房建设网站首页建设网络良好生态发挥网络的作用
  • 网站开发选题背景为网站制定一个推广计划
  • 网站后台页面是什么openvz wordpress
  • 网站开发团队人员网站建设费账务处理
  • 长沙网站排名系统企业采购平台哪个好
  • 低价网站建设咨询怎么做一个网站app吗
  • 如何百度到自己的网站网页设计超链接
  • 昆明猫咪网站建设公司网站连接跳转怎么做
  • 合肥 做网站的公司凡科小程序
  • 网站建设空间大小o2o平台有哪些可以入驻
  • 机关网站建设工程总结申请专利的网站
  • 龙岗住房建设局网站付费链接生成软件
  • 网站开发分析模板校园网上超市网站建设推广