javascript - Parse an HTML string with JS

preview_player
Показать описание
#short
#javascript
#html
#dom
#html-parsing
I want to parse a string which contains HTML text. I want to do it in JavaScript.
I tried the Pure JavaScript HTML Parser library but it seems that it parses the HTML of my current page, not from a string. Because when I try the code below, it changes the title of my page:
var parser = new HTMLtoDOM("htmlheadtitletitleTest/title/headbodya href='test0'test01/aa href='test1'test02/aa href='test2'test03/a/body/html", document);

My goal is to extract links from an HTML external page that I read just like a string.
Do you know an API to do it?
Рекомендации по теме