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条)

报告相同问题?

悬赏问题

  • ¥15 CMFCPropertyPage
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题
  • ¥15 谁会P4语言啊,我想请教一下
  • ¥15 哪个tomcat中startup一直一闪而过 找不出问题
  • ¥15 这个怎么改成直流激励源给加热电阻提供5a电流呀
  • ¥50 求解vmware的网络模式问题 别拿AI回答
  • ¥24 EFS加密后,在同一台电脑解密出错,证书界面找不到对应指纹的证书,未备份证书,求在原电脑解密的方法,可行即采纳