写一段 Python爬虫代码。实现用web of science查询文章的引用次数,包括自引和他引,将结果输出到一个word的表格
由于Web of Science的引用次数查询需要登录账户,因此这里提供的代码只是一个实现思路,需要自行登录并获取查询链接。
import requests from bs4 import BeautifulSoup from docx import Document from docx.shared import Inches
构造查询链接,这里需要自行登录并获取
url = "https://www.webofknowledge.com/...."
发送请求并获取响应内容
response = requests.get(url)
解析响应内容
soup = BeautifulSoup(response.content, "html.parser")
获取引用次数
citation_count = soup.find("div", {"class": "citation_count"}).text
将结果输出到Word表格
document = Document() table = document.add_table(rows=2, cols=2) table.cell(0, 0).text = "文章标题" table.cell(0, 1).text = "引用次数" table.cell(1, 0).text = "文章标题" table.cell(1, 1).text = citation_count document.save("citation_count.docx")
原文地址: http://www.cveoy.top/t/topic/ws1 著作权归作者所有。请勿转载和采集!