Instagram: Get photos by user and tag

后端 未结 4 1717
北荒
北荒 2021-02-05 17:15

Perusing the Instagram API I see it\'s pretty straightforward to search for photos by tag OR by username. However, I can\'t seem to find anything on searching by both. Is it pos

相关标签:
4条回答
  • 2021-02-05 17:24

    Wrote the code for you in php:

    $api = file_get_contents("https://api.instagram.com/v1/tags/YOURTAG/media/recent?access_token=YOURACCESSTOKEN");
    $json = json_decode($api,true);
    foreach($json['data'] as $data){
      if($data['user']['username']=="YOURSPECIFICUSERNAME"){
         //action
      }
    }
    

    Enjoy : )

    0 讨论(0)
  • 2021-02-05 17:25

    There is an opportunity how to do it:

    https://api.instagram.com/v1/tags/SEARCH_TAG/media/recent?client_id=CLIENT_ID&callback=MY_CALLBACK
    

    SEARCH_TAG - input

    CLIENT_ID - its your ID after registration

    MY_CALLBACK - your callback function.

    You will receive your response in Form of JSONP.

    After it you can search your response with the parameters your want.

    0 讨论(0)
  • 2021-02-05 17:42

    Your best bet is to do a lookup on a user and then sift through the results and get each picture with a certain tag

    0 讨论(0)
  • 2021-02-05 17:46

    You could make a list of images with a certain tag and then a list of images with a certain username. You could then compare the two lists. I'd recommend python with Beautiful Soup.

    0 讨论(0)
提交回复
热议问题