gpt4 book ai didi

python - 使用 Graph API 在 Facebook 中定位帖子的地理定位

转载 作者:行者123 更新时间:2023-11-28 18:53:20 26 4
gpt4 key购买 nike

我一直在尝试通过 Graph API 在页面上发布以地理位置为目标的状态更新,但到目前为止收效甚微。

使用 Facebook 图形 API,我已经能够成功地定位国家/地区,但不能定位城市或地区。

尝试其中任何一个:

>>> graph.put_object("me", "feed", message="Targeted at Boston", targeting={"countries": 'US', 'cities': 'boston, ma'})                                                                                     
>>> graph.put_object("me", "feed", message="Targeted at Boston", targeting={"countries": 'US', 'cities': ['us, boston, ma']})
>>> graph.put_object("me", "feed", message="Targeted at Boston", targeting=[{'country': 'us', 'city': 'boston', 'region': 'ma'}])
>>> graph.put_object("me", "feed", message="Targeted at Seattle", targeting={"countries": 'US', 'cities': [{'name': 'seattle, wa'}]})
>>> graph.put_object("me", "feed", message="Targeted at Seattle", targeting={"countries": 'US', 'cities': [{'name': 'seattle, wa'}]})

生成公开帖子或具有自定义隐私但未针对任何特定位置的帖子。

这个:

>>> graph.put_object("me", "feed", message="Targeted at Seattle", targeting={"countries": 'US'})

致力于有选择地仅针对美国。

我正在使用 Facebook python-sdk对于请求。

我一直在尝试多种方法来使定位生效,但文档很少,而且 Facebook 开发者论坛上没有太多可用信息。

有没有人能够传递用于地理定位多个目标的 json...例如波士顿、马萨诸塞州、巴黎、法国(法语),然后同时传递这两个目标?

最佳答案

问题是您需要城市和区域设置键,您可以在这里找到它们: https://developers.facebook.com/docs/reference/ads-api/get-autocomplete-data/

是的,你可以通过多个城市。

关于python - 使用 Graph API 在 Facebook 中定位帖子的地理定位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8431868/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com