0
jsdom을 사용하여 기사의 설명을 얻으려고합니다. 기사의 HTML 코드는 다음jsdom 이미지없이 텍스트를 얻을
<p><img src="http://localhost/bibi_cms/cms/app/images/upload_photo/1506653694941.png"
style="width: 599.783px; height: 1066px;"></p>
<p>testestestestestestestest<br></p>
이 내용에서 설명을 받고 내 nodejs 코드입니다, 처음 p 태그의 텍스트를 얻고 빈 문자열을 인쇄 할 것으로 보인다. 그래서 나는 단지 내용이 p 태그가 이미지를 포함하고 싶어. 누구든지이 문제에 대해 도움을 줍니까?
const dom = new JSDOM(results[i].content.toString());
if (dom.window.document.querySelector("p") !== null)
results[i].description = dom.window.document.querySelector("p").textContent;