Dissionpage实现 Molecular Plant文献获取
本帖最后由 13955925361 于 2024-5-23 20:34 编辑co中的参数请填写自己浏览器所在地址
page.get()的网址请填写自己想请求的具体网址(https://www.sciencedirect.comMolecular plant 主站中) 关键词自选
import numpy as np
import pandas as pd
from DrissionPage import ChromiumPage
from DrissionPage import ChromiumPage,ChromiumOptions
co=ChromiumOptions().set_paths(browser_path=r'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe')
page = ChromiumPage(co)
page.get('https://www.sciencedirect.com/search?qs=wheat&pub=Molecular%20Plant&cid=311979&sortBy=date')
a=page.eles('.ResultItem col-xs-24 push-m')
weblist=[]
for i in a:
t=i.ele('t:a').text
ppp=str(i.ele('.srctitle-date-fields').text)
pp = ppp.split(' ')[-2:]
p=' '.join(pp)
w=i.ele('t:a').attr('href')
j = 'Molecular Plant'
data = {
'Title': t,
'Pubdate': p,
'Journal': j,
'Web': w
}
weblist.append(w)
df = pd.DataFrame(data,index=)
df.to_csv('test1.csv',mode='a',index=False,header=False)
for i in weblist:
page.get(i,retry=3,interval=2,timeout=10)
try:
d = page.ele('.anchor doi anchor-default').attr('href')
except:
d = 'None'
try:
Ab = page.ele('#abspara0010').text
except:
Ab = 'None'
lis =
df = pd.DataFrame(lis)
df.to_csv('test2.csv', mode='a', index=False, header=False) 感觉Dissionpage比selenium强 Dissionpage很不错的 Dissionpage脚本运行正常,打包后提示缺少request包,,, tuyaking 发表于 2024-7-15 17:40
Dissionpage脚本运行正常,打包后提示缺少request包,,,
装一个,Terminal 里pip install 一个requests包
页:
[1]