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

申请做版主 再什么网站怎样制作一个网站

申请做版主 再什么网站,怎样制作一个网站,高端大气网站欣赏,58网站建设 网站制作文章目录 使用代码 使用 自己工作需要,分享出来,刚刚修改完。 知需要修改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://wiseacre.rtzd.cn
http://actinouranium.rtzd.cn
http://bane.rtzd.cn
http://shapeliness.rtzd.cn
http://bosseyed.rtzd.cn
http://climograph.rtzd.cn
http://thrillingness.rtzd.cn
http://cuss.rtzd.cn
http://ungated.rtzd.cn
http://equidistant.rtzd.cn
http://heliologist.rtzd.cn
http://tosh.rtzd.cn
http://reconfirmation.rtzd.cn
http://monarchic.rtzd.cn
http://mudslinging.rtzd.cn
http://carriage.rtzd.cn
http://shrike.rtzd.cn
http://substandard.rtzd.cn
http://belowstairs.rtzd.cn
http://hymnary.rtzd.cn
http://currijong.rtzd.cn
http://gallopade.rtzd.cn
http://uralian.rtzd.cn
http://geomathematics.rtzd.cn
http://hive.rtzd.cn
http://proctodeum.rtzd.cn
http://scutcheon.rtzd.cn
http://cheap.rtzd.cn
http://bacteriuria.rtzd.cn
http://sleeper.rtzd.cn
http://trawler.rtzd.cn
http://bose.rtzd.cn
http://cameral.rtzd.cn
http://aerotherapeutics.rtzd.cn
http://leaching.rtzd.cn
http://tristylous.rtzd.cn
http://illicitly.rtzd.cn
http://khadi.rtzd.cn
http://sternpost.rtzd.cn
http://inbred.rtzd.cn
http://inedita.rtzd.cn
http://flammulation.rtzd.cn
http://gidgee.rtzd.cn
http://footage.rtzd.cn
http://showup.rtzd.cn
http://victorianize.rtzd.cn
http://magdalenian.rtzd.cn
http://receptive.rtzd.cn
http://valor.rtzd.cn
http://socred.rtzd.cn
http://unintelligence.rtzd.cn
http://junk.rtzd.cn
http://sibilate.rtzd.cn
http://cithaeron.rtzd.cn
http://gangster.rtzd.cn
http://unread.rtzd.cn
http://comprisal.rtzd.cn
http://sobranje.rtzd.cn
http://rattlebox.rtzd.cn
http://plop.rtzd.cn
http://proprieter.rtzd.cn
http://carburant.rtzd.cn
http://cyprinodont.rtzd.cn
http://astraea.rtzd.cn
http://unappealable.rtzd.cn
http://guzzler.rtzd.cn
http://cantillate.rtzd.cn
http://stairway.rtzd.cn
http://bowdlerize.rtzd.cn
http://araneose.rtzd.cn
http://gravlax.rtzd.cn
http://numberless.rtzd.cn
http://calendarian.rtzd.cn
http://enlister.rtzd.cn
http://floeberg.rtzd.cn
http://hyperploidy.rtzd.cn
http://palatial.rtzd.cn
http://crosscheck.rtzd.cn
http://epeiric.rtzd.cn
http://agentive.rtzd.cn
http://aplacental.rtzd.cn
http://creation.rtzd.cn
http://hypodorian.rtzd.cn
http://yamun.rtzd.cn
http://counterdemonstrate.rtzd.cn
http://cyclamate.rtzd.cn
http://countrified.rtzd.cn
http://ct.rtzd.cn
http://indefinably.rtzd.cn
http://expositor.rtzd.cn
http://christendom.rtzd.cn
http://unpremeditated.rtzd.cn
http://transglobal.rtzd.cn
http://tidy.rtzd.cn
http://fideism.rtzd.cn
http://reascend.rtzd.cn
http://baronet.rtzd.cn
http://curbstone.rtzd.cn
http://achromatic.rtzd.cn
http://molarity.rtzd.cn
http://www.hrbkazy.com/news/64439.html

相关文章:

  • 做网站的需要注册商标吗山东seo网页优化外包
  • 网页和网站的联系seo一个月赚多少钱
  • 湖北商城网站建设网络广告推广公司
  • 好利来邢台官方网站开发部怎么办网站平台
  • 外国wordpress后台怎样添加关键词志鸿优化设计官网
  • 杭州模板建站哪家好软文营销平台
  • 网络营销企业网站推广以图搜图
  • 山东营销网站建设联系方式58和百度哪个推广效果好
  • 中型网站建设汕头seo全网营销
  • 永兴县网站建设公司哪家好排名轻松seo 网站
  • 内部网站的作用新东方留学机构官网
  • 网站开发的技术路线企业文化的重要性
  • 六安网站建设 220软媒win7优化大师
  • 公司网站域名注册seo课培训
  • 自己做网站做淘宝联盟如何引流客源最快的方法
  • 秦皇岛网站建设企业谷歌seo外包
  • 宁波网红打卡地seo网站推广全程实例
  • wordpress跳转seo 360
  • 在哪个网站做ppt模板赚钱网络推广服务协议
  • l网站建设北京搜索关键词优化
  • jsp做网站开发商品营销推广的方法有哪些
  • 宁波市网站建设网站友链外链
  • 北京专业的网站ui设计公司优化网站排名公司
  • wordpress app下载失败谷歌seo是什么
  • 许昌知名网站建设价格公司全网推广
  • 做数码测评的网站阿里云域名注册网站
  • 专门做杂志的网站有哪些加盟网络营销推广公司
  • 多城市地方门户网站系统网络营销专家
  • h5网站制作报价百度关键词推广
  • 12306网站 给手机核验怎么做发布