简体   繁体   English

从边缘/ [pageId] /帖子中过滤结果

[英]Filtering results from edge /[pageId]/posts

I would like to show the latest N Facebook posts on my website. 我想在我的网站上显示最新的N个Facebook帖子。

I am using this simple code: 我正在使用以下简单代码:

var FB = require('fb')

FB.api('/flourandfire/posts', 'get', { fields: [ 'message', 'picture' ], access_token: '1694494XXXXXXXX|1ba36298123bbf9689942fXXXXXXXXXX' }, 
function (res) {
  if (!res || res.error) {
    console.log(!res ? 'error occurred' : res.error)
    return
  }
  console.log(res)
})

However, I need to be able to have some kind of filtering, since there is "noise" in the feed due to the direct link with Instagram (which results in short posts with a picture, that I do NOT want to include in the website's feed) 但是,我需要能够进行某种过滤,因为由于与Instagram的直接链接,供稿中存在“噪音”(这会导致带有图片的简短帖子,因此我不想包含在网站的内容中)饲料)

I basically need to somehow "differentiate" specific posts, which will then placed on the site. 我基本上需要以某种方式“区分”特定帖子,然后将其放置在网站上。

I could fetch 100 posts and filter myself based on a specific tag (like #pub ; however, there is the risk of having lots of Instagram posts, more than 100, and end up with ZERO posts on the website. 可以获取100条帖子并根据特定标签(例如#pub过滤自己,但是,存在大量Instagram帖子(超过100条)的风险,最终在网站上显示零帖子。

How would you solve this issue? 您将如何解决这个问题?

There is no official filtering, i would do it like this: 没有官方过滤,我会这样:

  1. Get N entries by setting the limit parameter to N 通过将limit参数设置为N来获取N个条目
  2. Filter them on your own 自行过滤
  3. If there are less than N elements after filtering, use another API call to get more items 如果过滤后少于N个元素,请使用另一个API调用来获取更多项目
  4. Repeat from Number 2 从2号重复

Just an idea though, you could also increase the initial limit - but it would usually result in a slower API call so be careful with that. 虽然只是一个想法,但您也可以增加初始限制-但这通常会导致API调用变慢,因此请谨慎操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM