获取Facebook Graph Api中的所有帖子

时间:2016-09-08 07:17:52

标签: facebook python-2.7 facebook-graph-api

我正试着在我的脸书墙上收到所有生日帖子。 我正在使用Facebook图表Api,我通过发送请求来保存帖子。 而不是在我的墙上发布所有帖子。我只得到一个帖子说 41位朋友发布在你的墙上,其中包括最近3篇帖子。 如何使用facebook graph api获取所有41个帖子

client.indices.delete({index: _index});

    client.indices.create({
        index: _index,
        body: {
            "settings": {
                "analysis": {
                    "filter": {
                        "autocomplete_filter": {
                            "type": "edge_ngram",
                            "min_gram": 1,
                            "max_gram": 10
                        }
                    },
                    "analyzer": {
                        "autocomplete": {
                            "type": "custom",
                            "tokenizer": "standard",
                            "filter": [
                                "lowercase",
                                "autocomplete_filter"
                            ]
                        }
                    }
                }
            },
            "mappings": {
                "employee": {
                    "properties": {
                        "title": {
                            "type": "string",
                            "fields": {
                                "raw": {"type": "string", "index": "not_analyzed"}
                            }
                        },
                        "description": {
                            "type": "string",
                            "fields": {
                                "autocomplete": {"type": "string", "index_analyzer": "autocomplete"}
                            }
                        },
                        "interests": {
                            "type": "string"
                        },
                        "createdBy": {
                            "type": "string", "index": "not_analyzed"
                        },
                    }
                }
            }
        }

    }, function (error, response) {

       var body = [];
        Feed.find({},function(err, result){
          if(err) throw err;
          else{
            var jdata = JSON.stringify(result);
            var jsondata = JSON.parse(jdata);
           // console.log("result>>>"+result);
            jsondata.forEach(function(item){
           body.push({"index": {"_index": _index, "_type": _type}});
            body.push(item);
          })
}
client.bulk({
                    body: body
                }, function (err, resp) {
                    console.log('Indexing Completed!');
                })
        })
    })
    client.count({_index: 'company',_type: 'employee'},function(err,resp,status) {  
  console.log("constituencies",resp);
});

0 个答案:

没有答案