python scrapy解码方法和时间格式转换
import scrapy
from datetime import datetime class BianSpider(scrapy.Spider):
name = 'bian'
# allowed_domains = ['www']
start_urls = ['http://tech.163.com/special/00097UHL/tech_datalist.js?callback=data_callback'] def parse(self, response):
# print(response.body.decode('gbk'))
import json
---《for i in json.loads(response.body.decode('gbk').strip('data_callback(').strip(')')):》---
print(i['title'])
print(i['label'])
time_list = i['time']
---《print(datetime.strptime(time_list,'%m/%d/%Y %H:%M:%S'))》---
print(','.join([ii['keyname'] for ii in i['keywords']]))
desc_href = i['docurl']
yield scrapy.Request(desc_href,self.show) def show(self,response):
# print(response.xpath('//div[3]/div[2]/div[1]/div[1]//text()'))
types = response.xpath("string(//div[@class='post_crumb'])").extract_first().strip()
weizhi = ' '.join(response.xpath("//div[@class='post_crumb']//text()").extract()).strip() print(weizhi)
print(response.xpath('//*[@id="ne_article_source"]/text()').extract())
print(response.xpath('//*[@id="endText"]/div[2]/span[2]/text()').extract())
python scrapy解码方法和时间格式转换的更多相关文章
- 问题:Oracle to_date;结果:oracle常用的时间格式转换
oracle常用的时间格式转换 1:取得当前日期是本月的第几周 SQL> select to_char(sysdate,'YYYYMMDD W HH24:MI:SS') from dual; T ...
- SQL Server日期时间格式转换字符串详解 (详询请加qq:2085920154)
在SQL Server数据库中,SQL Server日期时间格式转换字符串可以改变SQL Server日期和时间的格式,是每个SQL数据库用户都应该掌握的.本文我们主要就介绍一下SQL Server日 ...
- SQL Server日期时间格式转换字符串
在SQL Server数据库中,SQL Server日期时间格式转换字符串可以改变SQL Server日期和时间的格式,是每个SQL数据库用户都应该掌握的.本文我们主要就介绍一下SQL Server日 ...
- MySQL时间戳和时间格式转换函数
MySQL时间戳和时间格式转换函数:unix_timestamp and from_unixtime unix_timestamp将时间转化成时间戳格式.from_unixtime将时间戳转化成时间格 ...
- Sql日期时间格式转换;取年 月 日,函数:DateName()、DATEPART()
一.sql server2000中使用convert来取得datetime数据类型样式(全) 日期数据格式的处理,两个示例: CONVERT(varchar(16), 时间一, 20) 结果:2007 ...
- SQL Server日期时间格式转换字符串详解
本文我们主要介绍了SQL Server日期时间格式转换字符串的相关知识,并给出了大量实例对其各个参数进行对比说明,希望能够对您有所帮助. 在SQL Server数据库中,SQL Server日期时间格 ...
- sql 日期时间格式转换
Sql日期时间格式转换 sql server2000中使用convert来取得datetime数据类型样式(全) 日期数据格式的处理,两个示例: CONVERT(varchar(16), 时间一, ...
- [php基础]Mysql日期函数:日期时间格式转换函数详解
在PHP网站开发中,Mysql数据库设计中日期时间字段必不可少,由于Mysql日期函数输出的日期格式与PHP日期函数之间的日期格式兼容性不够,这就需要根据网站实际情况使用Mysql或PHP日期转换函数 ...
- lua 特殊时间格式转换
[1]时间格式转换需求 工作中,因业务需要将时间格式进行转换.需求内容如下: 原格式:17:04:49.475 UTC Mon Mar 04 2019 转换格式:2019-03-04 17:04:4 ...
随机推荐
- 『计算机视觉』经典RCNN_其一:从RCNN到Faster-RCNN
RCNN介绍 目标检测-RCNN系列 一文读懂Faster RCNN 一.目标检测 1.两个任务 目标检测可以拆分成两个任务:识别和定位 图像识别(classification)输入:图片输出:物体的 ...
- 使用navigator.userAgent.toLowerCase()判断移动端类型
使用navigator.userAgent.toLowerCase()判断移动端类型 判断设备,区分Android,iphone,ipad和其它 var ua = navigator.userAgen ...
- 前端页面兼容ie8解决方法
一.通用兼容文件的引用: 1.HTML5标签兼容方案:html5shiv.js GitHub地址:https://github.com/aFarkas/html5shiv/ IE8不支持HTML5的新 ...
- zzw原创_Red Hat Enterprise Linux Server release 6.5 安装mysql5.5.28版本
1.查看系统版本 [root@ip12189 ~]# more /etc/issueRed Hat Enterprise Linux Server release 6.5 (Santiago)Ker ...
- InnoDB行记录格式(compact)、InnoDB数据页结构
1. compact 行记录格式: 变长字段长度列表,null标志位,记录头信息,列1数据,列2数据 …… 记录头信息中包含许多信息,只列举一部分: 名称 大小 描述 deleted_flag 1bi ...
- 命令创建Vue
创建vue+webpack vue init webpack projectName 基础 Vue+webpack+Vux 新建文件命令 # install vue-cli npm install - ...
- PAT-GPLT训练集 L1-043 阅览室
PAT-GPLT训练集 L1-043 阅览室 注意:连续的S和E才算一次借还 代码: #include<iostream> #include<cstdio> using nam ...
- 如何搭一个vue项目
1.yarn global add @vue/cli (vue/cli是webpack的二次开发) 2.vue create 自定义项目名称 3.选择Manually select featu ...
- 【框架】selenium运行失败后自动截图(三)
思路: 1.写一个类继承TestListenerAdapter,覆写onTestFailure()方法 2.在onTestFailure方法里,调用selenium的TakesScreenShot的g ...
- Oracle.练习题
2018-07-31 ---练习3 ---创建sporter表 create table sporter( sporterid ) constraint sport_id primary key, s ...