# -*- coding:utf-8 -*- import sys #print (u'系统默认编码为',sys.getdefaultencoding()) default_encoding = 'utf-8' #重新设置编码方式为uft-8 if sys.getdefaultencoding() != default_encoding: reload(sys) sys.setdefaultencoding(default_encoding) #print (u'系统默认编码为',sys.getdefaultencoding()) import requests from bs4 import BeautifulSoup import traceback import re import xlwt def getURLDATA(url): #url = 'http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-201901-1014' header={ 'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36', 'Connection': 'keep-alive',} r=requests.get(url,headers=header,timeout=30) #r.raise_for_status()抛出异常 html = BeautifulSoup(r.content.decode(),'html.parser') link=html.find(class_='detail_xq w770')#漏洞信息详情 link_introduce=html.find(class_='d_ldjj')#漏洞简介 link_others=html.find_all(class_='d_ldjj m_t_20')#其他 #print(len(link_introduce)) try: #print ("危害等级:"+link.contents[3].contents[3].find('a').text.lstrip().rstrip())#危害等级 list4.append(str(link.contents[3].contents[3].find('a').text.lstrip().rstrip())) except: #print("危害等级:is empty") list4.append("") try: #print ("CVE编号:"+link.contents[3].contents[5].find('a').text.lstrip().rstrip())#CVE编号 list5.append(str(link.contents[3].contents[5].find('a').text.lstrip().rstrip())) except: #print("CVE编号:is empty") list5.append("") try: #print ("漏洞类型:"+link.contents[3].contents[7].find('a').text.lstrip().rstrip())#漏洞类型 list6.append(str(link.contents[3].contents[7].find('a').text.lstrip().rstrip())) except : #print("漏洞类型:is empty") list6.append("") try: #print ("发布时间:"+link.contents[3].contents[9].find('a').text.lstrip().rstrip())#发布时间 list7.append(str(link.contents[3].contents[9].find('a').text.lstrip().rstrip())) except : #print("发布时间:is empty") list7.append("") try: #print ("威胁类型:"+link.contents[3].contents[11].find('a').text.lstrip().rstrip())#威胁类型 list8.append(str(link.contents[3].contents[11].find('a').text.lstrip().rstrip())) except : #print("威胁类型:is empty") list8.append("") try: #print ("更新时间:"+link.contents[3].contents[13].find('a').text.lstrip().rstrip())#更新时间 list9.append(str(link.contents[3].contents[13].find('a').text.lstrip().rstrip())) except : #print("更新时间:is empty") list9.append("") try: #print ("厂商:"+link.contents[3].contents[15].find('a').text.lstrip().rstrip())#厂商 list10.append(str(link.contents[3].contents[15].find('a').text.lstrip().rstrip())) except: #print("厂商:is empty") list10.append("") #link_introduce=html.find(class_='d_ldjj')#漏洞简介 try: link_introduce_data=BeautifulSoup(link_introduce.decode(),'html.parser').find_all(name='p') s="" for i in range(0,len(link_introduce_data)): ##print (link_introduce_data[i].text.lstrip().rstrip()) s=s+str(link_introduce_data[i].text.lstrip().rstrip()) #print(s) list11.append(s) except : list11.append("") if(len(link_others)!=0): #link_others=html.find_all(class_='d_ldjj m_t_20') #print(len(link_others)) try: #漏洞公告 link_others_data1=BeautifulSoup(link_others[0].decode(),'html.parser').find_all(name='p') s="" for i in range(0,len(link_others_data1)): ##print (link_others_data1[i].text.lstrip().rstrip()) s=s+str(link_others_data1[i].text.lstrip().rstrip()) #print(s) list12.append(s) except: list12.append("") try: #参考网址 link_others_data2=BeautifulSoup(link_others[1].decode(),'html.parser').find_all(name='p') s="" for i in range(0,len(link_others_data2)): ##print (link_others_data2[i].text.lstrip().rstrip()) s=s+str(link_others_data2[i].text.lstrip().rstrip()) #print(s) list13.append(s) except: list13.append("") try: #受影响实体 link_others_data3=BeautifulSoup(link_others[2].decode(),'html.parser').find_all('a',attrs={'class':'a_title2'}) s="" for i in range(0,len(link_others_data3)): ##print (link_others_data3[i].text.lstrip().rstrip()) s=s+str(link_others_data3[i].text.lstrip().rstrip()) #print(s) list14.append(s) except: list14.append("") try: #补丁 link_others_data3=BeautifulSoup(link_others[3].decode(),'html.parser').find_all('a',attrs={'class':'a_title2'}) s="" for i in range(0,len(link_others_data3)): ##print (link_others_data3[i].t
2022-04-11 15:18:10 9KB cnnvd python 爬虫
1
python爬取百度图片,用于物体识别和样本训练 自定义函数def getBaiduImag(category,length,path),用于采集百度图片,三个参数分别为搜索的“关键词”category,采集的图片数量length,保存图片的路径path。 自动检索当前下载目录下已有的图片数量,在此基础上再次采集length张图片。 需要导入的库文件有import requests、import json、import urllib、import pypinyin、import os
2022-04-11 14:42:53 2KB python 爬虫 样本采集 样本训练
1
VSTO爬取网页源码(VB.NET).txt 可直接复制使用
2022-04-11 09:00:25 3KB .net 爬虫
VB.NET网页源码爬取.zip VB.NET网页信息提取 分4级爬取,每级都显示提取结果 正则提取,代码非常简短 解决爬取不到网页源码的问题 网页信息提取不二选择
基于seleniu和chromdriver对淘宝1688进行信息爬取,支持自动翻页,能够获得商品价格,链接,商铺名字和商铺链接
2022-04-09 09:37:52 6.7MB 淘宝1688爬虫
1
主要介绍了python爬虫之快速对js内容进行破解,到一般js破解有两种方法,一种是用Python重写js逻辑,一种是利用第三方库来调用js内容获取结果,这次我们就用第三方库来进行js破解,需要的朋友可以参考下
2022-04-09 09:08:35 347KB python 爬虫 js 破解
1
第1章 课题概述 2 1.1 课题内容 2 1.2 课题背景 2 1.3 课题意义 3 1.4 运行环境 3 1.5 相关技术 3 1.5.1 Python语言 3 1.5.2 Flask框架 4 1.5.3 ECharts图表库 4 1.5.4 Jieba库 5 1.5.5 Pysql包 5 1.6 本章小结 5 第2章 系统设计 6 2.1 设计思想 6 2.2 需求分析 6 2.3 系统可行性分析 7 2.4 功能设计 7 2.4.1系统功能结构 7 2.4.2系统功能模块设计 8 2.4.3系统流程图 9 2.5 数据库设计 9 2.6 本章小结 10 第3章 系统实现 11 3.1 岗位信息爬取模块设计 11 3.2 数据库的连接及使用 13 3.2.1连接数据库 13 3.2.2数据概览数据库查询 13 3.2.3学历情况数据库查询 14 3.2.4企业情况数据库查询 15 3.2.5薪资情况数据库查询 16 3.3 数据可视化设计 16 3.3.1福利词云设计 16 3.3.2柱状图和折线图 18 3.3.3矩形树图 19 。。。。。。。。。。。。
2022-04-09 09:04:41 1.94MB 爬虫 python 招聘网站 网络爬虫
java爬虫项目实战源码.rar
2022-04-09 09:02:34 272.08MB 爬虫 java 开发语言 后端
寒假里学习了一下Python爬虫,使用最简单的方法扒取需要的天气数据,对,没听错,最简单的方法。甚至没有一个函数封装。。 网址:http://tianqi.2345.com/wea_history/53892.htm 火狐中右键查看网页源代码,没有发现天气数据,因此推断网页采用的json格式数据。 右击->查看元素->网络->JS,找到了位置 用Python爬虫下载为json格式数据存储下来,代码如下: #-*- coding:utf-8 -*- import urllib2 import json months = [1,2,3,4,5,6,7,8,9,10,11,12] years
2022-04-09 02:18:14 86KB python python函数 python实例
1
文章链接:https://blog.csdn.net/scz653037148/article/details/103448337 运用python爬虫实现的多网站小说下载工具。能够适用大部分网址。
2022-04-09 00:24:36 35.32MB 小说下载 爬虫 python爬虫 pyqt
1