Skip to content

Bug in node-html-parser. #164

Closed
Closed
@DevMoozi

Description

@DevMoozi

html from : https://arca.live/b/genshin/35384958
When node-html-parser picks a specific class Selector from the above site it doesn't work.

This is my code

import { parse } from "node-html-parser";
import got from "got";

const test = async () => {
  const { body } = await got("https://arca.live/b/genshin/35384958");
  const row = parse(body);
  console.log(row.querySelector(".article-content"));
};
test();

console.log output is

null

This is my code(parse by cheerio)

import cheerio from "cheerio";
import got from "got";

const test = async () => {
  const { body } = await got("https://arca.live/b/genshin/35384958");
  const $ = cheerio.load(body);
  console.log($(".article-content").toString());
};
test();

console.log output is

<div class="fr-view article-content"><p><img src="//ac2-p.namu.la/20210915s2/d68613e8a32b9d531b6a60494eb53060fa26463f4b41df151a16c3db36ea3f74.jpg" loading="lazy" width="690" height="2760"></p><p><img src="//ac-p.namu.la/20210915s1/9314e1f9d642365dd0d0663ac53e5ad27542f
63e1d4a406bc8a9e21e90a5394c.jpg" loading="lazy" width="690" height="973"></p><p><video src="//ac-p.namu.la/20211003s1/6545b66806b6c32e7d87ff175477d9af3bada18dbfd0b62353b4f698cfa80e3f.mp4" loading="lazy" autoplay="" loop="" muted="" playsinline="" controls=""></video><
/p><p>원작자 링크 <a href="https://www.pixiv.net/artworks/92749480" target="_blank">https://www.pixiv.net/artworks/92749480</a></p></div>

So I report this as I think this is a bug in node-html-parser.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions