Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in node-html-parser. #164

Closed
DevMoozi opened this issue Oct 9, 2021 · 1 comment
Closed

Bug in node-html-parser. #164

DevMoozi opened this issue Oct 9, 2021 · 1 comment
Labels

Comments

@DevMoozi
Copy link

DevMoozi commented Oct 9, 2021

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.

@nonara nonara added the bug label Oct 10, 2021
nonara added a commit to nonara/node-html-parser that referenced this issue Oct 10, 2021
@nonara nonara mentioned this issue Oct 10, 2021
@nonara nonara closed this as completed in 3c5b8e2 Oct 10, 2021
@nonara
Copy link
Collaborator

nonara commented Oct 10, 2021

Fixed in v5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants