How filter public posts by specific language or ge

2019-07-27 17:09发布

问题:

I'm trying to get the public posts for a specific subject with Facebook API en French for example (you need to change the access_token below) with this way :

https://graph.facebook.com/search?q=cinema&type=post&access_token=abc|abc&locale=fr_FR

This is not working. I have mixed languages (Spanish, French, English...) in the result. I checked the Facebook developers website and I cannot find a issue here. Somebody have the same problem?

In fact, if in the results, i have a lang key associated to each post, this would be good to me. I tried to add in the url fields=languages (and anothers words like lang,language,locale...) but this is not working too.

Thank you for your help! (sorry for my English)

回答1:

graph.facebook.com/search?q=cinema&type=post&locale=fr_FR

In fact, when running this query, the locale parameter is considered. It gives categories translated in French.

{
      "id": "376665779074901_525847047490106", 
      "from": {
        "category": "Site internet de détente/sports",
        "name": "Hasil+jadwal+klasemen Sepakbola", 
        "id": "376665779074901"
      }, 
      "message": "Hasil Pertandingan\n\nLike (y) & Bagikan ...\n\n• England- Premier League\nFT Chelsea 2 - 0 Fulham\nGoals :\n52'[1 - 0] Oscar\n84'[2 - 0] John Obi Mikel\n-\nFT Liverpool 0 - 1 Southampton\nGoals :\n54'[0 - 1] Dejan Lovren\n-\nFT Newcastle United 2 - 3 Hull City\nGoals :\n10'[1...
} 

But I must agree, it's not really helpful. The least you could do would be, in the case of a user post, to check what is the language the user is using:

graph.facebook.com/USER_ID?field=locale 

Apart from that, I have to say that you can't rely on Facebook's locale information. Facebook doesn't know if a post has been written in French or English. ALso, someone using Facebook in English doesn't mean he will only write english posts. If you want to find all messages in a specific language, better check all messages by yourself with another web service dedicated to language recognition.