2012-11-01 3 views

答えて

5

ここに始めるために見てみましょう: http://instagram.com/developer/

をして、タグで画像を取得するためには、ここを見て: http://instagram.com/developer/endpoints/tags/

のInstagramからタグを取得することはOAuthを必要としないので、あなたはこれらのURLを経由して通話を行うことができます。

GET IMAGES https://api.instagram.com/v1/tags/{tag-name}/media/recent?access_token={TOKEN}

SEARCH https://api.instagram.com/v1/tags/search?q={tag-query}&access_token={TOKEN}

TAG INFO https://api.instagram.com/v1/tags/{tag-name}?access_token={TOKEN}

14

まず、InstagramのAPIエンドポイント "タグは、" OAuth認証を必要としていました。

あなたはそれが5000に制限された率(X-レート制限リミット:5000)は、次のURL

を使用して、特定のハッシュタグ(この場合は雪)の結果を照会することができ、毎時

https://api.instagram.com/v1/tags/snowy/media/recent

サンプル応答

{ 
    "pagination": { 
    "next_max_tag_id": "1370433362010", 
    "deprecation_warning": "next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead", 
    "next_max_id": "1370433362010", 
    "next_min_id": "1370443976800", 
    "min_tag_id": "1370443976800", 
    "next_url": "https://api.instagram.com/v1/tags/snowy/media/recent?access_token=40480112.1fb234f.4866541998fd4656a2e2e2beaa5c4bb1&max_tag_id=1370433362010" 
    }, 
    "meta": { 
    "code": 200 
    }, 
    "data": [ 
    { 
     "attribution": null, 
     "tags": [ 
     "snowy" 
     ], 
     "type": "image", 
     "location": null, 
     "comments": { 
     "count": 0, 
     "data": [] 
     }, 
     "filter": null, 
     "created_time": "1370418343", 
     "link": "http://instagram.com/p/aK1yrGRi3l/", 
     "likes": { 
     "count": 1, 
     "data": [ 
      { 
      "username": "iri92lol", 
      "profile_picture": "http://images.ak.instagram.com/profiles/profile_404174490_75sq_1370417509.jpg", 
      "id": "404174490", 
      "full_name": "Iri" 
      } 
     ] 
     }, 
     "images": { 
     "low_resolution": { 
      "url": "http://distilleryimage1.s3.amazonaws.com/ecf272a2cdb311e2990322000a9f192c_6.jpg", 
      "width": 306, 
      "height": 306 
     }, 
     "thumbnail": { 
      "url": "http://distilleryimage1.s3.amazonaws.com/ecf272a2cdb311e2990322000a9f192c_5.jpg", 
      "width": 150, 
      "height": 150 
     }, 
     "standard_resolution": { 
      "url": "http://distilleryimage1.s3.amazonaws.com/ecf272a2cdb311e2990322000a9f192c_7.jpg", 
      "width": 612, 
      "height": 612 
     } 
     }, 
     "users_in_photo": [], 
     "caption": { 
     "created_time": "1370418353", 
     "text": "#snowy", 
     "from": { 
      "username": "iri92lol", 
      "profile_picture": "http://images.ak.instagram.com/profiles/profile_404174490_75sq_1370417509.jpg", 
      "id": "404174490", 
      "full_name": "Iri" 
     }, 
     "id": "471425773832908504" 
     }, 
     "user_has_liked": false, 
     "id": "471425689728724453_404174490", 
     "user": { 
     "username": "iri92lol", 
     "website": "", 
     "profile_picture": "http://images.ak.instagram.com/profiles/profile_404174490_75sq_1370417509.jpg", 
     "full_name": "Iri", 
     "bio": "", 
     "id": "404174490" 
     } 
    } 
} 

あなたはこの辺りで再生することができます:

https://apigee.com/console/instagram?req=%7B%22resource%22%3A%22get_tags_media_recent%22%2C%22params%22%3A%7B%22query%22%3A%7B%7D%2C%22template%22%3A%7B%22tag-name%22%3A%22snowy%22%7D%2C%22headers%22%3A%7B%7D%2C%22body%22%3A%7B%22attachmentFormat%22%3A%22mime%22%2C%22attachmentContentDisposition%22%3A%22form-data%22%7D%7D%2C%22verb%22%3A%22get%22%7D

OAuth 2として「認証」を使用する必要があり、Instagram経由でログインするように求められます。 「テンプレート」セクションで「タグ名」を再入力する必要があるかもしれないことを記してください。

ページング関連のすべてのデータは、応答の「ページ区切り」パラメータで使用でき、「next_url」を使用して次の結果セットを照会します。

+0

次のページURLを取得するには?私は、PHPやjavascriptで次の応答のセットを取得する意味ですか? – user1788736

+0

応答の "next_url"を使用して、さらなる結果を問い合わせます。詳細については、http://instance.com/developer/endpoints/paginationを参照してください。 –

10

複数のタグを使用してコンテンツを検索することはまだできません。現在は1つのタグのみがサポートされています。

まず、Instagram APIエンドポイントの「タグ」にはOAuth認証が必要です。

これはあまり意味がありません。APIキーが必要です。ちょうどregisterアプリケーションをあなたの要求に追加してください。 例:

https://api.instagram.com/v1/users/userIdYouWantToGetMediaFrom/media/recent?client_id=yourAPIKey 

はまた、ユーザ名がユーザIDではないことに注意してください。ユーザーIDを検索することができますhere.

複数のキーワードを検索するための回避策は、各タグに対して1つのリクエストを開始し、サーバー上の結果を比較する場合です。もちろん、これにより、比較したいキーワードの量に応じてサイトの速度が低下する可能性があります。

関連する問題