I’m trying to scrape all of meaning and similar word data from this site https://en.dict.naver.com/#/search?query=${variable}
[ex)https://en.dict.naver.com/#/search?query=win]
the scrape result is null
async function web(word){
const browser = await puppeteer.launch({headless : false});
const page = await browser.newPage();
await page.goto('https://en.dict.naver.com/#/search?query='+encodeURIComponent(word),{waitUntil:'networkidle0'});
console.log('https://en.dict.naver.com/#/search?query='+encodeURIComponent(word))
let meandata = await page.$$(".section.section_keyword .mean");
let mean = await page.evaluate(elements => {
return elements.map(element => element.textContent);
}, meandata);
let sidata = await page.$$(".component_summary _thesaurusSwiper .word");
let si = await page.evaluate(elements => {
return elemenst.map(element => element.textContent);
}, sidata);
await browser.close();
const result = {min,si}
return result;
};
app.post('/index',whlo,async function(req,res){
if(req.body.added){
const word = req.body.added;
const result = await web(word);
console.log(result)
})
output
https://en.dict.naver.com/#/search?query=word
{
min: [
null, null, null, null, null,
null, null, null, null, null,
null, null, null, null, null,
null, null, null, null, null,
null, null, null, null, null,
null
],
si: [
null, null, null, null,
null, null, null, null,
null, null, null, null,
null, null, null, null,
null, null, null, null,
null, null
]
}
the link is correct but the output is null
i think there may be a problem with the code let meandata = await page.$$(".mean");
or html code of that site but i dont know what is wrong although i’ve seen some similar questions in stack overflow
expect
{
min: [
이기다, (경기 등에서 이겨 무엇을) 따다[타다/차지[쟁취]하다], 승리, 근로 장려책, [타도 인플레이션] ((Gerald R. Ford 대통령 시대의 슬로건)),
남자 이름(Winfred, Winston의 애칭), 전투원정보통신망],
si: [
prevail, ˌwin ˈout, triumph, win the ˈday,
come out on ˈtop]
}
박성우 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.