node js cheerio获取带有格式标签的html文本

时间:2017-12-11 20:07:13

标签: javascript html node.js cheerio

我使用cheerion获取html格式文本,但是当我得到$(“element”)。html();十六进制的html返回:

&#x413;&#x430;&#x441;&#x442;&#x440;&#x43E;&#x43B;&#x438; &#x413;&#x43E;&#x441;&#x443;&#x434;&#x430;&#x440;&#x441;&#x442;&#x432;&#x435;&#x43D;&#x43D;&#x43E;&#x433;&#x43E; &#x410;&#x43A;&#x430;&#x434;&#x435;&#x43C;&#x438;&#x447;&#x435;&#x441;&#x43A;&#x43E;&#x433;&#x43E; &#x442;&#x435;&#x430;&#x442;&#x440;&#x430; &#x438;&#x43C;. &#x41C;&#x43E;&#x441;&#x441;&#x43E;&#x432;&#x435;&#x442;&#x430;<br><b><br>&#x412;&#x418;&#x428;&#x41D;&#x415;&#x412;&#x42B;&#x419; &#x421;&#x410;&#x414; - &#x410;.&#x41F;.&#x427;&#x415;&#x425;&#x41E;&#x412;<br><br><i>&#x41A;&#x43E;&#x43C;&#x435;&#x434;&#x438;&#x44F; &#x432; 4-&#x445; &#x434;&#x435;&#x439;&#x441;&#x442;&#x432;&#x438;&#x44F;&#x445;</i></b><br><br>&#x41F;&#x43E;&#x441;&#x442;&#x430;&#x43D;&#x43E;&#x432;&#x43A;&#x430; &#x438; &#x441;&#x446;&#x435;&#x43D;&#x43E;&#x433;&#x440;&#x430;&#x444;&#x438;&#x44F;

但我需要保存所有合成标签,例如<br>,<i>,<b>,文字将如下:

<i> <b> <br> NO AGE RESTRICTIONS !!! </ b> </ i> <br> <br> <b> The iconic figure of Russian show business Yegor Creed will soon present his new solo program to Israeli audiences </ b> <br> <br> At the moment, <b> Egor Creed </ b> is one of the most sought-after performers on the Russian stage, his tracks are in the first lines of radio station charts, and the clips are gaining millions of hits . <br> <br> The solo artist's program consists of hits and singles already known to all from the new album "What Do They Know?" The new record offers us to see an adult musician: the texts are more informative, the music is more interesting. The album sounds at the level of world music trends and sets a new benchmark for our show business. <br> 

0 个答案:

没有答案