duanchuonong5370 2015-12-02 07:10
浏览 121
已采纳

如何从pinterest获得所有引脚? 只有50针

I get only top 50 pins at a time using this code

https://api.pinterest.com/v3/pidgets/users/lorihiney/pins/

is there any way to get all pins of a particular user .

  • 写回答

3条回答 默认 最新

  • dqyz48470 2016-12-03 16:39
    关注

    I faced this problem too when trying to use the API and it left me pulling my hair out!!

    I ended up creating a recursive function using info I found online to get all the child pages of a board, while also pushing the pins to an array.

    I first saved all my boards to a MYSQL table, then the pins in another. Saves on API calls and made finding duplicates much easier (that was what I was trying to use it for)!

    $pins=array();
    
    function findchildren(&$array, $i){
     global $pins;
    
     if (true == $i){return;}
    
        foreach($array as $k=>$v){
         array_push($pins, $v['data']);
           if(!empty($v['page']['next'])){
           $newar = curlfunction($v['page']['next']);
           findchildren($newar, false);
           }
        }
     }
    

    So something like:

    $board = curlfunction('https://api.pinterest.com/v1/boards/lorihiney/diet/pins/?access_token=xxxxx&limit=100&fields=id,link,counts,note,url,image');
    findchildren($board, false);
    

    You'd just need to create the cURL function to get the data!!

    My Pinterest account has 31 boards and 1890 pins. Works a treat for me after spending AGES trying to figure it out. Hope that it helps somewhat.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)