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解码方法和时间格式转换的更多相关文章

  1. 问题:Oracle to_date;结果:oracle常用的时间格式转换

    oracle常用的时间格式转换 1:取得当前日期是本月的第几周 SQL> select to_char(sysdate,'YYYYMMDD W HH24:MI:SS') from dual; T ...

  2. SQL Server日期时间格式转换字符串详解 (详询请加qq:2085920154)

    在SQL Server数据库中,SQL Server日期时间格式转换字符串可以改变SQL Server日期和时间的格式,是每个SQL数据库用户都应该掌握的.本文我们主要就介绍一下SQL Server日 ...

  3. SQL Server日期时间格式转换字符串

    在SQL Server数据库中,SQL Server日期时间格式转换字符串可以改变SQL Server日期和时间的格式,是每个SQL数据库用户都应该掌握的.本文我们主要就介绍一下SQL Server日 ...

  4. MySQL时间戳和时间格式转换函数

    MySQL时间戳和时间格式转换函数:unix_timestamp and from_unixtime unix_timestamp将时间转化成时间戳格式.from_unixtime将时间戳转化成时间格 ...

  5. Sql日期时间格式转换;取年 月 日,函数:DateName()、DATEPART()

    一.sql server2000中使用convert来取得datetime数据类型样式(全) 日期数据格式的处理,两个示例: CONVERT(varchar(16), 时间一, 20) 结果:2007 ...

  6. SQL Server日期时间格式转换字符串详解

    本文我们主要介绍了SQL Server日期时间格式转换字符串的相关知识,并给出了大量实例对其各个参数进行对比说明,希望能够对您有所帮助. 在SQL Server数据库中,SQL Server日期时间格 ...

  7. sql 日期时间格式转换

    Sql日期时间格式转换   sql server2000中使用convert来取得datetime数据类型样式(全) 日期数据格式的处理,两个示例: CONVERT(varchar(16), 时间一, ...

  8. [php基础]Mysql日期函数:日期时间格式转换函数详解

    在PHP网站开发中,Mysql数据库设计中日期时间字段必不可少,由于Mysql日期函数输出的日期格式与PHP日期函数之间的日期格式兼容性不够,这就需要根据网站实际情况使用Mysql或PHP日期转换函数 ...

  9. lua 特殊时间格式转换

    [1]时间格式转换需求 工作中,因业务需要将时间格式进行转换.需求内容如下: 原格式:17:04:49.475  UTC Mon Mar 04 2019 转换格式:2019-03-04 17:04:4 ...

随机推荐

  1. stl中的transform()注意其与for_each的不同点(有无返回值)

    #include<iostream> using namespace std; #include"vector" #include"algorithm&quo ...

  2. java使用线程设置定时任务

    private static int a=0; public static void main( String[] args ) { timer(); } public static void tim ...

  3. python BeautifulSoup 介绍--安装

    Python中,专门用于HTML/XML解析的库: 特点是: 即使是有bug,有问题的html代码,也可以解析. BeautifulSoup主要有两个版本 BeautifulSoup 3 之前的,比较 ...

  4. 创建属性Attribute

    XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(xmlPath); var root = xmlDoc.DocumentElement;//取到 ...

  5. C# 3.0 / C# 3.5 Lambda 表达式

    概述 Lambda 表达式的本质就是匿名函数.(而匿名方法的本质是委托) “Lambda 表达式”是一个匿名函数,可以包含表达式和语句,并且可用于创建委托或表达式树类型. (Lambda 表达式的运算 ...

  6. ECharts 报表事件联动系列一:刷新页面

    本示例实现了以下功能: 1.点击刷新按钮,仅刷新柱状图,而不是整个页面 2.点击柱状内容刷新柱状图,并更新title 3.点击X轴,Y轴更新title,并弹出alert. 源码代码如下: <!D ...

  7. 图解ActiveMQ virtual topic

    http://activemq.apache.org/virtual-destinations.html 普通的 topic 是发布/订阅模式:消息会被广播发送给所有的订阅者,订阅者拿到的是全部消息, ...

  8. Linux安装配置NFS教程(CentOS 6.5)

    一.服务端安装nfs 1.1安装 yum install -y rpcbind yum install -y nfs-utils 1.2配置nfs共享目录 这里以/nfs目录为例 mkdir /nfs ...

  9. python3线程启动与停止

    转自: https://blog.csdn.net/weixin_38125866/article/details/76795462 https://www.cnblogs.com/lcchuguo/ ...

  10. shell脚本学习之参数传递

    shell之参数传递 我们可以在执行 Shell 脚本时,向脚本传递参数,脚本内获取参数的格式为:$n.n 代表一个数字,1 为执行脚本的第一个参数,2 为执行脚本的第二个参数,以此类推…… 实例 以 ...