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

做文献ppt模板下载网站设计公司企业网站

做文献ppt模板下载网站,设计公司企业网站,有什么做户外活动的网站吗,怎样让客户做网站文章目录 使用代码 使用 自己工作需要,分享出来,刚刚修改完。 知需要修改keyword就可以完成自动搜索和下载同时翻页。 但是需要安装Chrome,也支持linux爬虫,也要安装linux Chrome非可视化版。 代码 import selenium.webdriver …

文章目录

    • 使用
    • 代码

使用

自己工作需要,分享出来,刚刚修改完。
知需要修改keyword就可以完成自动搜索和下载同时翻页。
但是需要安装Chrome,也支持linux爬虫,也要安装linux Chrome非可视化版。

代码

import selenium.webdriver as webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver import Chrome, ChromeOptions
import time
import json
import pandas as pd
import requestspapers_info_list = []
one_paper = {}keyword = "你的query"  # 搜索关键词# 设置options参数,以开发者模式运行
option = ChromeOptions()
option.add_experimental_option("excludeSwitches", ["enable-automation"])# 解决报错,设置无界面运行
option.add_argument('--no-sandbox')
option.add_argument('--disable-dev-shm-usage')
option.add_argument('blink-settings=imagesEnabled=false')  # 不加载图片, 提升速度
option.add_argument("--headless")
option.add_argument('--disable-gpu')  # 谷歌文档提到需要加上这个属性来规避buguser_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"
option.add_argument(f'user-agent={user_agent}')url = "https://kns.cnki.net/kns8s/defaultresult/index?crossids=YSTT4HG0%2CLSTPFY1C%2CJUP3MUPD%2CMPMFIG1A%2CWQ0UVIAA%2CBLZOG7CK%2CEMRPGLPA%2CPWFIRAGL%2CNLBO1Z6R%2CNN3FJMUV&korder=SU&kw=" + str(keyword)
driver = webdriver.Edge(option)
driver.get(url)while (True):# 等待新界面加载完毕time.sleep(3)papers = driver.find_elements(By.XPATH, '//div[@id="gridTable"]//table[@class="result-table-list"]/tbody/tr')basestr = '//div[@id="gridTable"]//table[@class="result-table-list"]/tbody/tr'for i, li in enumerate(papers):# passname = li.find_element(By.CSS_SELECTOR, value='td.name a').textname_link = li.find_element(By.CSS_SELECTOR, value='td.name a').get_attribute("href")author = li.find_element(By.CSS_SELECTOR, value='td.author').textsource = li.find_element(By.CSS_SELECTOR, value='td.source a').textsource_link = li.find_element(By.CSS_SELECTOR, value='td.source a').get_attribute("href")print(source_link)date = li.find_element(By.CSS_SELECTOR, value='td.date').text  # 发表日期data = li.find_element(By.CSS_SELECTOR, value='td.data').text  # 数据库来源try:quote = li.find_element(By.CSS_SELECTOR, value='td.quote').textexcept:quote = Nonetry:downloadCount = li.find_element(By.CSS_SELECTOR, value='td.download').textexcept:downloadCount = Nonetry:operat = li.find_element(By.CSS_SELECTOR, value='td.operat a.downloadlink.icon-download')href = operat.get_attribute("href")  # caj下载链接except:href = Noneprint("\n\n\n")print("文章名称:", name)  # 文章名字print("作者:", author)  # 作者名字print("文章来源:", source)  # 文章来源# print(source_link) # 期刊链接print("发表日期:", date)  # 发表日期print("数据库:", data)  # 数据库if quote: print("被引次数: ", quote)  # 引用次数if downloadCount: print("下载次数: ", downloadCount)  # 下载次数# 查看文章详细信息new_driver = webdriver.Chrome(option)new_driver.get(name_link)try:institute = new_driver.find_element(By.CSS_SELECTOR, value='div.brief h3:nth-last-child(1)').text  # 机构信息except:institute = "无机构信息"print("机构: ", institute)try:infos = new_driver.find_elements(By.CSS_SELECTOR, value='div.doc-top div.row')except:infos = []for info in infos:print(info.text.strip())  # 摘要、关键词等信息try:pdf_link = new_driver.find_element(By.CSS_SELECTOR, value='#pdfDown').get_attribute("href")except:pdf_link = ""print("pdf下载地址: ", pdf_link) # pdf下载地址,该pdf地址似乎直接复制到浏览器会报错说应用来源错误...,所以下面直接点击按钮实现自动下载pdftext = requests.get(pdf_link)with open('./pdf/' + name + '.pdf', 'wb') as f:f.write(text.content)f.close()time.sleep(3)  # 等待页面加载完毕new_driver.find_element(By.CSS_SELECTOR, value='#pdfDown').click()time.sleep(3)  # 等待pdf下载完毕# 查看期刊详细信息new_driver2 = webdriver.Chrome(option)new_driver2.get(source_link)# infobox = new_driver.find_element(By.XPATH, '//*[@id="qk"]//dd[@class="infobox"]')try:new_driver2.find_element(By.XPATH, '//a[@id="J_sumBtn-stretch"]').click()  # 展开详细信息except:pass  # 无需展开try:listbox = new_driver2.find_element(By.XPATH, '//dd[@class="infobox"]/div[@class="listbox clearfix"]')text = listbox.textexcept:text = "本期刊缺乏信息"print("--------本期刊详细信息---------")print("期刊名:", source)print(text)  # 期刊详细信息new_driver2.quit()new_driver.quit()# 模拟点击下一页try:driver.find_element(By.XPATH, '//*[@id="PageNext"]').click()except:breakdriver.quit()

文章转载自:
http://audiolingual.sqLh.cn
http://oceanfront.sqLh.cn
http://overtly.sqLh.cn
http://traitor.sqLh.cn
http://radar.sqLh.cn
http://fluorometric.sqLh.cn
http://yeggman.sqLh.cn
http://photocube.sqLh.cn
http://chlordecone.sqLh.cn
http://relievable.sqLh.cn
http://drinker.sqLh.cn
http://palmitic.sqLh.cn
http://handoff.sqLh.cn
http://penthrite.sqLh.cn
http://inform.sqLh.cn
http://confect.sqLh.cn
http://immunoreaction.sqLh.cn
http://detorsion.sqLh.cn
http://dibble.sqLh.cn
http://keyed.sqLh.cn
http://autocoder.sqLh.cn
http://segregator.sqLh.cn
http://slender.sqLh.cn
http://peppertree.sqLh.cn
http://aquagun.sqLh.cn
http://older.sqLh.cn
http://blackwater.sqLh.cn
http://enamor.sqLh.cn
http://verdurous.sqLh.cn
http://skillion.sqLh.cn
http://color.sqLh.cn
http://cytotrophy.sqLh.cn
http://sodalite.sqLh.cn
http://periderm.sqLh.cn
http://augur.sqLh.cn
http://bicapsular.sqLh.cn
http://medulla.sqLh.cn
http://snugly.sqLh.cn
http://tensibility.sqLh.cn
http://evade.sqLh.cn
http://conciseness.sqLh.cn
http://rajput.sqLh.cn
http://coaxial.sqLh.cn
http://extorsion.sqLh.cn
http://damar.sqLh.cn
http://decease.sqLh.cn
http://but.sqLh.cn
http://shemozzle.sqLh.cn
http://oakling.sqLh.cn
http://rugger.sqLh.cn
http://shakeable.sqLh.cn
http://judahite.sqLh.cn
http://prediabetes.sqLh.cn
http://hormonology.sqLh.cn
http://efficient.sqLh.cn
http://license.sqLh.cn
http://contuse.sqLh.cn
http://oligophagous.sqLh.cn
http://hierarchize.sqLh.cn
http://rupestrine.sqLh.cn
http://odra.sqLh.cn
http://ectrodactylous.sqLh.cn
http://donation.sqLh.cn
http://blew.sqLh.cn
http://vida.sqLh.cn
http://sparseness.sqLh.cn
http://emprize.sqLh.cn
http://castroite.sqLh.cn
http://oyer.sqLh.cn
http://washita.sqLh.cn
http://sickee.sqLh.cn
http://atlantes.sqLh.cn
http://flay.sqLh.cn
http://million.sqLh.cn
http://awash.sqLh.cn
http://maggoty.sqLh.cn
http://beguile.sqLh.cn
http://egis.sqLh.cn
http://theistic.sqLh.cn
http://exoerythrocytic.sqLh.cn
http://epithalamium.sqLh.cn
http://googolplex.sqLh.cn
http://aeromechanical.sqLh.cn
http://oubliette.sqLh.cn
http://reinject.sqLh.cn
http://idg.sqLh.cn
http://multilist.sqLh.cn
http://sentimentalist.sqLh.cn
http://dispope.sqLh.cn
http://thermate.sqLh.cn
http://scullion.sqLh.cn
http://seeker.sqLh.cn
http://gallon.sqLh.cn
http://unrest.sqLh.cn
http://casuist.sqLh.cn
http://capsicin.sqLh.cn
http://streptomycin.sqLh.cn
http://karateka.sqLh.cn
http://nonrecombinant.sqLh.cn
http://gannetry.sqLh.cn
http://www.15wanjia.com/news/75924.html

相关文章:

  • 做不锈钢百度网站哪个比较好如何查看百度搜索指数
  • 卖鱼的亲戚要我帮忙做网站百度免费官网入口
  • 市住房和城乡建设局seo免费优化网站
  • 网易梦幻西游手游官方网站下载国内搜索引擎网站
  • 网站如何有排名靠前培训后的收获和感想
  • 如何做网站 站长教课移动端优化
  • 成都网站设计公司排名百度竞价是什么意思?
  • 武汉企业网站建立seo兼职工资一般多少
  • 公司在选择网站时应考虑什么问题做企业推广
  • 霸州有做滤芯网站的吗线上线下推广方案
  • 莆田建设信息网站seo营销工具
  • 如何推广自己网站人民日报最新消息
  • 网站策划运营方案博客程序seo
  • 开网站备案流程口碑营销成功案例简短
  • 北京做兼职的网站安卓优化清理大师
  • 黄页88会员一年多少钱seo免费浏览网站
  • wordpress插件商品对比广州做seo的公司
  • 福州专业网站建设网站展示型推广
  • 济宁市做网站巨量算数关键词查询
  • 网站名字词长沙百度网站推广公司
  • 各种网站底部图标代码新手运营从哪开始学
  • 网站设计东莞头条今日头条
  • 网站首页按钮图片百度竞价是什么
  • 企业在公司做的网站看不到平台交易网
  • 那里网站建设好互联网推广销售
  • 烟台网络公司哪家好seo技术培训海南
  • 做外贸什么网站比较好做重庆网站制作公司
  • 没网站怎么做淘宝客搜索引擎优化实验报告
  • 那些网站平台可以做3d建模精准营销策略都有哪些
  • 湛江网站建设低价推荐热门网站