seregazhuk / php-pinterest-bot Goto Github PK
View Code? Open in Web Editor NEWThis PHP library will help you to work with your Pinterest account without using any API account credentials.
License: MIT License
This PHP library will help you to work with your Pinterest account without using any API account credentials.
License: MIT License
When products are clicked on the news feed, a POST is sent to the Pinterest servers to log that click. Are we able to add that event to this API?
I believe it is sent to: https://uk.pinterest.com/resource/UserExperienceViewedResource/update/
Dear @seregazhuk ,
Can you please check why "setOptions" is not working now.
$bot->getHttpClient()->setOptions([
CURLOPT_PROXY => $proxy,
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36',
]);
$var = $bot->user->registerBusiness($email, $pass, $rname);
I tried to set proxy and then try to registerBusiness() to create accounts and there are errors as follows:
(I have checked the proxy by Firefox and it works. Also, if I remove the setOptions() instructions, it works fine and can create new accounts)
Catchable fatal error: Argument 2 passed to seregazhuk\PinterestBot\Api\Response
::getValueByKey() must be of the type array, null given, called in E:\xampp\htdo
cs\pinterestNewVersionClientInfo\vendor\seregazhuk\pinterest-bot\src\Api\Respons
e.php on line 80 and defined in E:\xampp\htdocs\pinterestNewVersionClientInfo\ve
ndor\seregazhuk\pinterest-bot\src\Api\Response.php on line 94
There's a bug in the function:
RequestHelper.php:
public static function createRequestData($data, $sourceUrl = null)
{
return [
"source_url" => $sourceUrl,
"data" => json_encode($data, JSON_FORCE_OBJECT),
];
}
Because of JSON_FORCE_OBJECT
, bookmarks are encoded incorrectly:
{"0": "Pz9Nakl5TX...YxNmRjNQ=="}
instead of
["Pz9Nakl5TX...YxNmRjNQ=="]
It makes the option invalid and the first page is always being returned.
Is there a way to request different pages? I know we can set a limit for searches and other things, but it'd be nice to set a limit and page. We'd like to be able to get the first 100 results, then the 2nd 100 results is a separate call. Is there any way to do that currently? If not, are there plans to add this in?
it is so easy to be banned by php client, even i only execute few actions. how to hide my bot identity?
Userinfo function return
Array
(
[impressum_url] =>
[last_name] => Bardhan
[domain_verified] =>
[following_count] => 245
[image_medium_url] => https://s-media-cache-ak0.pinimg.com/avatars/ibardhan_1420212276_75.jpg
[like_count] => 4
[image_xlarge_url] => https://s-media-cache-ak0.pinimg.com/avatars/ibardhan_1420212276_280.jpg
[full_name] => Indrojit Bardhan
[image_small_url] => https://s-media-cache-ak0.pinimg.com/avatars/ibardhan_1420212276_30.jpg
[id] => 544161704884351899
[first_name] => Indrojit
[domain_url] =>
[explicitly_followed_by_me] =>
[location] =>
[indexed] => 1
[is_partner] =>
[type] => user
[image_large_url] => https://s-media-cache-ak0.pinimg.com/avatars/ibardhan_1420212276_140.jpg
[board_count] => 1
[username] => ibardhan
[repins_from] => Array
(
[0] => Array
(
[username] => JBL316
[repins_from] => Array
(
)
[image_medium_url] => https://s-media-cache-ak0.pinimg.com/avatars/JBL316_1416014134_75.jpg
[full_name] => jbl
[image_small_url] => https://s-media-cache-ak0.pinimg.com/avatars/JBL316_1416014134_30.jpg
[id] => 344314471419780089
)
)
[verified_identity] => Array
(
)
[twitter_url] =>
[facebook_url] => https://www.facebook.com/indrojit.bardhan.5
[has_showcase] =>
[follower_count] => 0
[pin_count] => 2
[about] =>
[show_impressum] =>
[has_board] => 1
[website_url] =>
[blocked_by_me] =>
)
Hi
bit confuse how to use proxy in this script
for example i want to register - > login -> create board then logout, how should I do to make all that 4 step using proxy, if using standard step maybe i can use just like this (cmiiw) but how when i should use proxy, how to do it?
$bot->auth->register('[email protected]', 'password', 'Name');
$result = $bot->auth->login('mypinterestlogin', 'mypinterestpassword');
$bot->boards->create('name', 'description');
$bot->auth->logout();
thank you
I have a staging pinterest account (non-business) with 2 public boards, 2 secret boards. On staging, boards->forUser() will successfully grab all 4 boards. On my business Pinterest account, I have 88 public boards and 4 secret boards. Using boards->forUser('userHere',100) with this business account only fetches 88 of the 92 boards. Not sure if the difference in number of boards or difference in type of account (normal vs business) is causing the change in behavior.
Hi seregazhuk,
I tried this code:
$info = $bot->pins->info('393994667383919015');
print_r($info);
and the output is "1". It seems that something wrong. Right? Can you plz check it.
why nnobody makes a fb php bot?
Hello @seregazhuk,
Login is failing now. It's creating the cookie file as follows:
I have tried with two accounts, same results. Let me know.
Thanks.
sorry maybe this is not issue but request, is there any possible to add link to every pinner, i mean right now when i do a pin
$bot->pins->create('http://exmaple.com/image.jpg', $boards[0]['id'], 'pin description');
when i try to open the board, and click the image, it goes directly to http://exmaple.com/image.jpg is there any option to add specific link rather than link to the image url, maybe like
$bot->pins->create('http://exmaple.com/image.jpg','http://google.com', $boards[0]['id'], 'pin description');
so when i click the image it goes to google.com
Pins search return empty result.
My code (before it worked):
require_once("vendor/autoload.php"); use seregazhuk\PinterestBot\Factories\PinterestBot; $bot = PinterestBot::create(); var_dump($bot->pins->search("car", 10));
My Result :
object(Generator)#11 (0) { }
Привет!
Сегодня ночью отрубилась прокси с которой я работал, ожидал что в таком случае отработает функция $bot->auth->isLoggedIn() или проверка записи куки. На скорую руку вписал в Cookie 47 строку
if (file($file) == false) {
echo "Не получили Cookie, проверить возможность записи в папку или прокси!";
exit();
}
Вот что выдает при логине $bot->auth->login($log, $pas);:
Warning: file(C:\Users\Max\AppData\Local\Temp\[email protected]): failed to open stream: No such file or directory in C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Helpers\Cookies.php on line 48
Call Stack:
0.0630 143336 1. {main}() C:\OpenServer\domains\scripts.loc\www\pinterest\dead_houzz.php:0
2.2031 959696 2. pinterest_login(???, ???, ???) C:\OpenServer\domains\scripts.loc\www\pinterest\dead_houzz.php:27
2.2081 1181272 3. seregazhuk\PinterestBot\Api\Providers\ProviderWrapper->login(???, ???) C:\OpenServer\domains\scripts.loc\www\pinterest\dead_houzz.php:126
2.2081 1181576 4. seregazhuk\PinterestBot\Api\Providers\ProviderWrapper->__call(???, ???) C:\OpenServer\domains\scripts.loc\www\pinterest\dead_houzz.php:126
2.2081 1181944 5. call_user_func_array:{C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\Providers\ProviderWrapper.php:38}(???, ???) C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\Providers\ProviderWrapper.php:38
2.2081 1182224 6. seregazhuk\PinterestBot\Api\Providers\Auth->login(???, ???, ???) C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\Providers\ProviderWrapper.php:38
2.2091 1182824 7. seregazhuk\PinterestBot\Api\Providers\Auth->processLogin(???, ???) C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\Providers\Auth.php:42
2.2091 1203496 8. seregazhuk\PinterestBot\Api\Providers\Provider->execPostRequest(???, ???, ???) C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\Providers\Auth.php:178
2.2101 1203848 9. seregazhuk\PinterestBot\Api\Providers\Provider->execute(???, ???) C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\Providers\Provider.php:56
2.2101 1203928 10. seregazhuk\PinterestBot\Api\Request->exec(???, ???) C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\Providers\Provider.php:88
2.2101 1205304 11. seregazhuk\PinterestBot\Api\CurlHttpClient->execute(???, ???, ???) C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\Request.php:102
2.2101 1206800 12. seregazhuk\PinterestBot\Api\CurlHttpClient->callCurl() C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\CurlHttpClient.php:89
2.2291 1206080 13. seregazhuk\PinterestBot\Api\CurlHttpClient->fillCookies() C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\CurlHttpClient.php:103
2.2291 1206080 14. seregazhuk\PinterestBot\Helpers\Cookies->fill(???) C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\CurlHttpClient.php:285
2.2291 1206112 15. file(???) C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Helpers\Cookies.php:48
И вот что при $bot->auth->isLoggedIn() - phpstorm при добавлении в watch пишет cannot evaluate expression, но при этом в алгоритме
if ($bot->auth->isLoggedIn()) {
//go go code
} else {
Проходит почему-то как TRUE и выдает:
Warning: Invalid argument supplied for foreach() in C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Helpers\Cookies.php on line 48
Call Stack:
0.0630 143336 1. {main}() C:\OpenServer\domains\scripts.loc\www\pinterest\dead_houzz.php:0
2.2031 959696 2. pinterest_login(???, ???, ???) C:\OpenServer\domains\scripts.loc\www\pinterest\dead_houzz.php:27
2.2081 1181272 3. seregazhuk\PinterestBot\Api\Providers\ProviderWrapper->login(???, ???) C:\OpenServer\domains\scripts.loc\www\pinterest\dead_houzz.php:126
2.2081 1181576 4. seregazhuk\PinterestBot\Api\Providers\ProviderWrapper->__call(???, ???) C:\OpenServer\domains\scripts.loc\www\pinterest\dead_houzz.php:126
2.2081 1181944 5. call_user_func_array:{C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\Providers\ProviderWrapper.php:38}(???, ???) C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\Providers\ProviderWrapper.php:38
2.2081 1182224 6. seregazhuk\PinterestBot\Api\Providers\Auth->login(???, ???, ???) C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\Providers\ProviderWrapper.php:38
2.2091 1182824 7. seregazhuk\PinterestBot\Api\Providers\Auth->processLogin(???, ???) C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\Providers\Auth.php:42
2.2091 1203496 8. seregazhuk\PinterestBot\Api\Providers\Provider->execPostRequest(???, ???, ???) C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\Providers\Auth.php:178
2.2101 1203848 9. seregazhuk\PinterestBot\Api\Providers\Provider->execute(???, ???) C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\Providers\Provider.php:56
2.2101 1203928 10. seregazhuk\PinterestBot\Api\Request->exec(???, ???) C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\Providers\Provider.php:88
2.2101 1205304 11. seregazhuk\PinterestBot\Api\CurlHttpClient->execute(???, ???, ???) C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\Request.php:102
2.2101 1206800 12. seregazhuk\PinterestBot\Api\CurlHttpClient->callCurl() C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\CurlHttpClient.php:89
2.2291 1206080 13. seregazhuk\PinterestBot\Api\CurlHttpClient->fillCookies() C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\CurlHttpClient.php:103
2.2291 1206080 14. seregazhuk\PinterestBot\Helpers\Cookies->fill(???) C:\OpenServer\domains\scripts.loc\vendor\seregazhuk\pinterest-bot\src\Api\CurlHttpClient.php:285
$bot->pins->create() works first time, it only creates about 30+ pins and then it stops working, seems like my server IP gets blocked by pinterest.
I need to create bulk Pins to my Pinterest account.
any idea, how to create large number of pins?
Seem like the $bot->auth->register() does not work anymore.
Please check again.
Добрый день!
Как с помощью вашего бота получить список пинов по запросу вот такого вида
https://www.pinterest.com/source/giphy.com/
И отсюда нужно получить количество досок для каждого пина с данного сайта, далее некое подобие вот такого запроса который отображает общее количество пинов для данного URL пина https://api.pinterest.com/v1/urls/count.json?&url=http://giphy.com/gifs/colbertlateshow-stephen-colbert-late-show-l44QiBOm1VJ97BOhO
you have great code. It's amazing. Thank you so much!
I think the like function is broken. I'm able to login, post a pin or get pin info. However like doesn't seem to work, as the like count doesn't update on pinterest and the like function below doesn't return anything. For example in the snip below, I'm able to login and $pin_info is an array with all the pin's info however $like_info doesn't return anything and the like count doesn't go up.
$bot->login($usr, $pwd);
$pin_info = $bot->pins->info($pin_id);
print_r($pin_info);
$like_info = $bot->pins->like($pin_id);
print_r($like_info);
Fatal error: Class 'Pinterest\ApiRequest' not found in C:\xampp\htdocs\pinterestp\pin.php on line 13
Hi, great api :)
I am trying to create new profile with register
mehtod and I've false
any time I try..
Does it actually works?
thank you
Used this code:
require('vendor/autoload.php');
use seregazhuk\PinterestBot\Factories\PinterestBot;
$bot = PinterestBot::create();
$login = $bot->auth->login('login', 'pass'); //return true
$a=$bot->pins->feed(100);
$b=$bot->pins->search('batman',100);
print_r($a); //It returns an array of strange data, which are not similar to the correct data.
print_r($b); //It returns an array of strange data, which are not similar to the correct data.
I wrote a code to register account and it works at first but after 30 minutes i can't register any new account from that. The bot is alway return :
"Your account has been suspended. Learn more at https://www.pinterest.com/_/_/about/acceptable-use-policy/"
Привет! Еще раз хочу поблагодарить за столь прекрасный и полезный код который меня выручил )
Подскажите, сложно ли / возможно ли добавить возможность работать мультипоточно через прокси и разные аккаунты? Скорости очень-очень не хватает - даже для API запросов, получается на обработку около 1.5 сек, а когда нужно прошерстить тысячи запросов - уходят часы.
Не стоит ли это в планах разработки, и если да, то возможно вас простимулировать дополнительно $? :)
Также хотелось бы функцию типа random rotate user agent с привязкой к конкретному аккаунту и конкретной проксе под каждый аккаунт.
Hello @seregazhuk ,
I am using this for a while and really liked it!
I noticed that there is currently no options to invite people, will there be any chance to get it in near future?
Thanks.
Hi,
I'm new, how to install this bot ?
Thanks.
Hello. I'm having a Issue.
can you help me?
This sample code run.
require '../vendor/autoload.php';
use seregazhuk\PinterestBot\Factories\PinterestBot;
$bot = PinterestBot::create();
$result = $bot->auth->login('id', 'pass');
if (!$result) {
echo $bot->getLastError();
die();
}
result:
Fatal error: Can't use method return value in write context in /php-pinterest-bot/src/Api/Response.php on line 112
when I run this script, the results that appear are API_ERROR. how do I fix it?
Доброго дня! Работаю не первую неделю под Windows/Openserver и все работает отлично.
Под Centos + Vesta , PHP 5.6.30 (cli) (как и под Windows) вылазит ошибка. Версия бота "seregazhuk/pinterest-bot": "^5.2.3" под Windows , а Centos - последняя версия 5.2.4.
PHP Fatal error: Call to a member function isEmpty() on boolean in /home/admin/web/11.12.76.157/public_html/vendor/seregazhuk/pinterest-bot/src/Helpers/Pagination.php on line 144
При исполнении такого кода:
$related = $bot->pins->related('56224695328753842', 500); //Не важно какой pin
foreach ($related as $pin) {
//mynewbiecode
}
Добегает до определенного пина (например, до 478) и выдает ошибку т.к. чаще всего related < 500 , хотя под Windows на старой версии "бегает" даже если всего 10 пинов.
I fresh installed a server and install Apache, PHP 5.6 on Centos 7.1
I uploaded all file one server in pin
folder and created a new.php
with sample code.
<?php
use seregazhuk\PinterestBot\PinterestBot;
$bot = new PinterestBot('mypinterestlogin', 'mypinterestpassword');
$bot->login();
$boards = $bot->boards->my();
echo $boards;
Added my details in above code and and accessed new.php
file on browser.
http://x.x.x.x/pin/new.php
PHP Fatal error: Class 'seregazhuk\PinterestBot\PinterestBot' not found in /var/www/html/pin/new.php on line 5, referer: http://x.x.x.x/pin/new.php
What's the problem???
hi, i can't login using pinterest bot and getLastError returns empty.
can you help me to find out what happened?
`$username = "";
$passwd = "";
$bot = PinterestBot::create();
// 1. proxy
//$bot->getHttpClient()->useProxy("112.74.133.239", "82");
// 2. Login
$result = $bot->auth->login($username, $passwd);
if (!$result) {
echo "last error:".$bot->getLastError()."\n";
die();
}
if ($bot->user->isBanned()) {
die("Account $username has been banned!\n");
}
//
// Get lists of your boards
$boards = $bot->boards->forUser('user');
var_dump($boards);`
First of all, thanks very much for the library, everything has been working great for me apart for unfollow functionality. I use it as in the readme:
$bot->pinners->unfollow($userId);
However the user is not being unfollowed. I checked the error and I am getting:
[code] => INVALID_HTTP_METHOD_FOR_RESOURCE_METHOD
[target] => None
[http_status] => 400
Any idea why this could happen?
Thanks a lot!
i want to get pins of a specified board.
Is this possible i dont see any way for this ?!
Hi @seregazhuk ,
It seems that $bot->user->profile() is not work in the current version. Can you please fix it!
Thanks,
My name is Simon I sent you an email please reply............
I used this library to create a new account with, but I never did receive a confirmation email from Pinterest. Looking at the account, I couldn't see where I was supposed to confirm my email address.
Then, when I started using the library for that account, my account got shut down. Have you experienced this issue (not receiving the confirmation email)? Is there a way to prevent this from happening? I've tested on a Gmail account and an owned domain email account to see if it was Gmail only, but it's not.
Hi, I wonder if I can make a request here. Can you please support the feature Edit pin for this Bot. The input will be the pinID and other necessary infos to update for that pin. something like:
public function editPin($pinID, $description = "new Description", $link = "new Link")
Thanks in advance,
I am using the script as per your readme file to search for pins and whether I write to an array or iterate over the generator object, the maximum I can get is 25.
For example:
$results0 = $bot->pins->search('kitchens', 0)->toArray(); echo count($results0). "<br/>"; //25 $results20 = $bot->pins->search('kitchens', 20)->toArray(); echo count($results20). "<br/>"; //20 $results50 = $bot->pins->search('kitchens', 50)->toArray(); echo count($results50). "<br/>";// 25 $results100 = $bot->pins->search('kitchens', 100)->toArray(); echo count($results100). "<br/>"; //25
I wonder what I'm doing wrong?
How to get a prticulat pin details using pin id
On every iteration Generator returns the same results.
Hello,
I can't find a single board with the $bot->boards->info($username, $board) since he is just getting all the user boards in a single array response ignoring the $board param.
it seems like the 'slug' param in the request is not correctly handled by the pinterest endpoint
Dear author,
I must say that your tool is awesome. Could I ask for one more feature about User Settings. Can you plz support to upload the profile picture for account automatically, Maybe it should look like: $bot->user->profile([profile_image'=>'my-selfie.jpg']);
may have to know the number of people who follow me?
Hi,
Thank you for your bot. I have tested it and it's really good. But one problem is that the feature to get user following not work. Can you please check. Thanks.
foreach($bot->pinners->following('username') as $followingBatch)
{
// ...
}
$pinterest->pinners->followers($username)
produces an error:
'resource_response' =>
array(2) {
'data' =>
NULL
'error' =>
array(5) {
'api_error_code' =>
int(30)
'message' =>
string(15) "User not found."
'code' =>
string(9) "API_ERROR"
'target' =>
string(66) "<webapp.resources.user_resource.UserResource object at 0x1b26f110>"
'http_status' =>
int(404)
}
}
The error throws for any valid $username
.
How can I get my own feed that showing on the main page https://pinterest.com/?
it returns Generator Object ( )
I've tried to use pins create method and I got following error:
AuthException in ProviderLoginCheckWrapper.php line 54: You must log in before.
Yes I have used login function before calling this method and I get return true (as I assume its successfully logged in).
Currently I am using XAMPP
Hello sir
just wonder does the profile image still work?
because i try few time, the profile image cant uploaded
thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.