如何利用抓包内容,编写GET中headers配置信息? #8366
Replies: 3 comments 7 replies
-
const $ = cheerio.load(response.body);
const out = $(".title_item")
.map((i, e) => {
$(e).find(".access-text").remove();
return {
title: $(e).find(".hlFld-Title").text(),
link: $(e).find(".ref.nowrap").attr("href"),
pubDate: $(e).find(".open-access.item-access").text(),
};
})
.get();
console.log(out); |
Beta Was this translation helpful? Give feedback.
7 replies
Answer selected by
Derekmini
-
|
Beta Was this translation helpful? Give feedback.
0 replies
-
FreeOctober 2021 more... The Journal of the Acoustical Society of America 150, R7 (2021); https://doi.org/10.1121/10.0006522 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
您好,想请教一个配置
got
中header
的写法:描述问题
我遇到一个网页:https://asa.scitation.org/toc/jas/current,想利用如下语句获取每篇文章的信息( 如
const list = $('section.card')
)。出现问题的地方在:查看
response.data
,发现其中的html
内容并不完整,经查看不包含每篇文章的内容,导致不能使用const $ = cheerio.load(response.data);
获取想要的信息。我只能暂时认为是
headers
没有配置好,所以想通过抓包,写出一个有效的headers
配置信息。现有抓包内容以及尝试改写的无效代码
现有的抓包内容
另附一张图片,我是通过Fillder抓取的:
Fillder抓取的内容
尝试改写的无效代码
其他尝试
之前通过
puppeteer
也完成了想实现的路由功能,但是现在由于资源开销大等原因,路由工作不太正常,所以想换回推荐的获取方式。虽然接触的时间比较长了,但没有系统地学习过这方面的知识,所以还希望您能给一些提示,能帮我打开一下思路,谢谢您的帮助!
Beta Was this translation helpful? Give feedback.
All reactions