Unable to perform requests in node js

最后都变了- 提交于 2019-12-13 04:16:31

问题


I have some code like this:-

const request=require('request');
const url=require('url');
const cheerio=require('cheerio');

request({uri: 'https://www.facebook.com/'}, (err, resp, body)=>{
    var $=cheerio.load(body);
    console.log($('title').text());
    console.log($('body').text())
});

When I try to request to facebook or google the response returned is something like:-

Facebook - ??? ??? ?????? | Facebook
??????? login or signup ??????? ??

or

Google
Signin??? ???....

How can I solve these question marks?

来源:https://stackoverflow.com/questions/58750335/unable-to-perform-requests-in-node-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!