简体   繁体   English

如何使用 API 从 Instagram 帖子中获取位置地理标签

[英]How to get the location geotag from an Instagram post using the API

I'm trying to get the location geotag from an already posted Instagram post using the Basic Display Instagram API?我正在尝试使用 Basic Display Instagram API 从已发布的 Instagram 帖子中获取位置地理标签?

I can't find any endpoints that let me get the location.我找不到任何可以让我获取位置的端点。 Am I missing something or is that something we just cannot do?我错过了什么还是我们不能做的事情?

It appears at this time you can only set the location-id when creating a piece of media via the API but it is not available when retrieving a piece of media.此时看来,您只能在通过 API 创建媒体时设置location-id ,但在检索媒体时不可用。

POST call to API https://developers.facebook.com/docs/instagram-api/reference/ig-user/media#create-photo-container POST 调用 API https://developers.facebook.com/docs/instagram-api/reference/ig-user/media#create-photo-con

Fields available when making a GET call https://developers.facebook.com/docs/instagram-api/reference/ig-media#fields进行 GET 调用时可用的字段https://developers.facebook.com/docs/instagram-api/reference/ig-media#fields

This can be done by opening the post, right-clicking on top of the post, tick mark Properties, and then Location.这可以通过打开帖子,右键单击帖子顶部,勾选属性,然后位置来完成。 You will get a map with location coordinates in decimal degrees which you can use to pinpoint that spot on Google Maps or another mapping service.您将获得一个 map,其位置坐标以十进制度为单位,您可以使用它在 Google 地图或其他地图服务上查明该地点。 APIs calculate this too but APIs are for developers only so it is not accessible to an average Instagram user unless you're building an app related to it. API 也会计算这一点,但 API 仅供开发人员使用,因此普通 Instagram 用户无法访问它,除非您正在构建与之相关的应用程序。

You can get it using the data365.co Instagram API with which I work.您可以使用我使用的 data365.co Instagram API 获取它。

If you have a post ID or shortcode, you can build a task to download it via a POST request: https://api.data365.co/v1.1/instagram/post/CYjV-nusXA8/update?access_token=TOKEN如果您有帖子 ID 或短代码,您可以构建一个任务以通过 POST 请求下载它: https://api.data365.co/v1.1/instagram/post/CYjV-nusXA8/update?access_token=TOKEN

This GET request returns you the information about the publication: https://api.data365.co/v1.1/instagram/post/CYjV-nusXA8?access_token=TOKEN此 GET 请求会返回有关出版物的信息: https://api.data365.co/v1.1/instagram/post/CYjV-nusXA8?access_token=TOKEN

You receive such a list of fields, including the location_id:您会收到这样的字段列表,包括 location_id:

{
    "data": {
    

"attached_media_content": null,
    "attached_media_display_url": "https://instagram.fclj4-1.fna.fbcdn.net/v/t51.2885-15/e35/s1080x1080/271671353_2486006594877541_7824177366520402526_n.jpg?_nc_ht=instagram.fclj4-1.fna.fbcdn.net&_nc_cat=101&_nc_ohc=6N-Dwpx8IvEAX9Zjcvp&edm=AABBvjUBAAAA&ccb=7-4&oh=00_AT88wqJiMtaSe4Ma8xtcixRCdaIozxnXKK_6k1W-84k3ZQ&oe=61E6FF84&_nc_sid=83d603",
    "attached_media_tagged_users": [
        "dilettazamba.iti",
        "laura_medeghini"
    ],
    "attached_video_url": null,
    "comments_count": 8,
    "created_time": "2022-01-10T14:04:24",
    "id": "2748136859869737020",
    "is_comments_disabled": false,
    "is_video": false,
    "likes_count": 257,
    "location_id": "447269731",
    "owner_id": "182171607",
    "related_posts": null,
    "shortcode": "CYjV-nusXA8",
    "sponsors": [
        "dilettazamba.iti",
        "laura_medeghini"
    ],
    "text": "Pretending it was not all about grappa 🦠#italiansdoitbetter🇮🇹",
    "text_lang": "en",
    "text_tagged_users": null,
    "text_tags": [
        "italiansdoitbetter"
    ],
    "timestamp": 1641823464,
    "video_plays_count": null,
    "video_views_count": null
    },
    "error": null,
    "status": "ok"
}

If you need to get more location data, you can create a task to download location information.如果您需要获取更多的位置数据,您可以创建一个任务来下载位置信息。

An creating a task example, POST request:创建任务示例,POST 请求:

https://api.data365.co/v1.1/instagram/location/447269731/update?access_token=TOKEN https://api.data365.co/v1.1/instagram/location/447269731/update?access_token=TOKEN

Example of getting data, GET request:获取数据示例,GET请求:

https://api.data365.co/v1.1/instagram/location/447269731?access_token=TOKEN https://api.data365.co/v1.1/instagram/location/447269731?access_token=TOKEN

An example of location data from a GET request:来自 GET 请求的位置数据示例:

{
    "data": {
        "address": null,
        "city": null,
        "country_code": "IT",
        "description": null,
        "external_url": "http://www.regione.lombardia.it/",
        "has_public_page": false,
        "id": "447269731",
        "is_exact_city_match": null,
        "is_exact_country_match": null,
        "is_exact_region_match": true,
        "latitude": 45.65,
        "longitude": 9.95,
        "name": "Lombardy",
        "phone": null,
        "posts_count": 752322,
        "primary_alias_on_fb": "234765516537015",
        "region": "Lombardia",
        "slug": "lombardy",
        "thumb_url": "https://instagram.fhel6-1.fna.fbcdn.net/v/t51.2885-15/e35/s150x150/133538449_422161569029342_6176236793032572073_n.jpg?_nc_ht=instagram.fhel6-1.fna.fbcdn.net&_nc_cat=102&_nc_ohc=TKr1bwmeTxsAX8c_2AW&tp=1&oh=6d7d9df9654741083884c5880496fc5a&oe=60269982",
        "zip_code": null
    },
    "error": null,
    "status": "ok"
}

You can see more information about our API capability and the data it provides at https://data365.co/instagram .您可以在https://data365.co/instagram上查看有关我们的 API 功能及其提供的数据的更多信息。

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

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