开发者

is there a method like 'get_meta_tags' in Node.js?

开发者 https://www.devze.com 2023-02-15 23:04 出处:网络
I want to extract the meta-tags from an url, especially the title and the description but i 开发者_运维技巧don\'t know how to do this. I tried with http://nodejs.org/docs/v0.4.2/api/http.html#http.req

I want to extract the meta-tags from an url, especially the title and the description but i 开发者_运维技巧don't know how to do this. I tried with http://nodejs.org/docs/v0.4.2/api/http.html#http.request but i get errors like '411'.


Node only parses HTTP, not HTML or other content types. Thankfully, there is a full DOM implementation for node here:

https://github.com/tmpvar/jsdom

Load up your HTML content there, and that'll get you pretty close to your PHP example.

0

精彩评论

暂无评论...
验证码 换一张
取 消