Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/417.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript nodejs请求url并返回json,正文为空_Javascript_Node.js_Request_Instagram - Fatal编程技术网

Javascript nodejs请求url并返回json,正文为空

Javascript nodejs请求url并返回json,正文为空,javascript,node.js,request,instagram,Javascript,Node.js,Request,Instagram,我找到了一个有趣的解决方案来获取instagram的公共档案照片 var name = "smena8m", items; $.getJSON("https://query.yahooapis.com/v1/public/yql?callback=?", { q: "select * from json where url='https://www.instagram.com/" + name + "/?__a=1'", format: "json" }, function(data

我找到了一个有趣的解决方案来获取instagram的公共档案照片

var name = "smena8m",
  items;
$.getJSON("https://query.yahooapis.com/v1/public/yql?callback=?", {
  q: "select * from json where url='https://www.instagram.com/" + name + "/?__a=1'",
  format: "json"
}, function(data) {
  console.log(data);
  if (data.query.results) {
    items = data.query.results.json.user.media.nodes;
    $.each(items, function(n, item) {
      $('body').append(
        $('<a/>', {
          href: 'https://www.instagram.com/p/'+item.code,
          target: '_blank'
        }).css({
          backgroundImage: 'url(' + item.thumbnail_src + ')'
        }));
    });
  }

});
但是我的
body
返回空。有人能帮我在nodejs中实现同样的目标吗

更新: 响应代码为200,正文为空。

将myurl更改为:

 myurl='https://www.instagram.com/' +name '/?__a=1';

控制台。日志(身体)然后你应该高兴

所以。。。如果您不发送请求的“sql”,它将如何到达另一端?majick elves?删除
?回调=?
——因为您不想在nodejs中获取JSONP
 myurl='https://www.instagram.com/' +name '/?__a=1';