Comments (38)
Hi @huuvu1109 , thank you for your request. I've updated the library, download the latest version.
Now you can edit pin by it's id. You can change pin's description, link or board.
// change description and link
$bot->pins->edit($pinId, 'new description', 'new link');
// change board
$bot->pins->edit($pinId, 'new description', 'new link', $newBoardId);
If you only want to change pin's board (move it to another board) use this method:
// change board
$bot->pins->moveToBoard($pinId, $newBoardId);
from php-pinterest-bot.
Hi @seregazhuk , thanks alot for your quick responses. I have updated and tested it, i works very well. It is a really good bot!
from php-pinterest-bot.
Hi @seregazhuk ,
It's me again. One more request if I can. Can you please support getting Pins from a specific url. It's very useful if the bot can do that. For example: https://pinterest.com/source/flickr.com/ will return recent Pins which is from flickr.com.
from php-pinterest-bot.
@huuvu1109, yes, download the latest version and now you can use something like this:
foreach ($bot->pins->fromSource('flickr.com') as $pins) {
// ...
}
from php-pinterest-bot.
thanks @seregazhuk . It works nicely.
from php-pinterest-bot.
Hello @seregazhuk ,
I just find this also very interesting. If it is possible, can you also support it. When you find some keyword on pinterest, it recommend popular search words related to your keyword. Can you please support to get these words automatically.
For example, if search for "London" (https://www.pinterest.com/search/pins/?q=london&rs=typed&0=london%7Ctyped), Pinterest will recommend a lot of popular searchs like "things to do in london", "london england". People can choose the suitable word which matching their needs by clicking the corresponding word right below.
from php-pinterest-bot.
Hi, @huuvu1109 . Yes, it is possible. Download the latest version (3.2.0) and try this:
$keywords = $bot->keywords->recommendedFor('query');
from php-pinterest-bot.
Hi @seregazhuk ,
It works well, but can you please add one more option to return the complete keyword. I mean instead of return the suggested additional keywords, can you return the complete keyword (the combination between "search keyword" and "recommended keywords". For example, with the search "London",
- Things To Do In --> return "Things To Do In London" instead
- Living In -> return "Living In London" instead
- Architecture -> return "London Architecture" instead
from php-pinterest-bot.
No, I think that it is better to return the same values that have been returned from Pinterest. Here you are going to change the default behavior of Pinterest response. The bot gives you results like in browser and it is a one line of code for you to add a query word.
from php-pinterest-bot.
Hi @seregazhuk ,
Thanks for your quick answer. I understand that the code should be one line. Just let me explain why I think that option is useful:
I start with the keyword "dress", Pinterest recommends "for teens" (mean 'dress for teen'). Now I click to select "for teens", Pinterest continue recommend "formal" (which means 'formal dress for teens'). That means that after selecting 3 keywords, it is equivalent to search for the phrase 'formal dress for teens'.
So, if the return result is just 'for teen', we have two cases:
a) 'dress for teens': if you search for this phrases DIRECTLY, Pinterest will recommend the 'formal' keywords.This is because 'formal dress for teens' is a popular phrase.
b) 'for teens dress': if you search for this phrase DIRECTLY, Pinterest NOT recommend 'formal' because 'formal for teens dress' is not popular.
So actually the complete phrase have its purpose. I mean with this example, if I know the complete keyword 'dress for teens', I can reach 'formal' keyword. Otherwise, I cannot 'formal' from 'for teens dress'
Moreover, I think Pinterest also return both results. When you put the mouse on the additional keyword, it shows the complete keyword. For example, you search "dress", it recommend "for teens". Now, if you put the mouse on the "for teens", you will see that it is "dress for teens" (not "for teens dress").
So, the usefulness of the complete keywords is that from "dress" , we can obtain "for teens", then if I want a longer recommended keyword, I can search again for the query "dress for teens", and I obtain "formal dress for teens". If we don't have the complete keyword, we can never reach "formal dress for teens" from "dress" (we must try different combinations).
from php-pinterest-bot.
Oh, I've understood. But Pinterest returns the response without the search keyword.
It simply concatenates keywords when you click on them. But the recommended results mean nothing without the search query because they are related to it.
Download the latest version to get changes. Now the query will be concatenated with each keyword:
$keywords = $bot->keywords->recommendedFor('dress');
print_r($keywords);
/*
Array
(
[0] => dress for teens
[1] => dress wedding
[2] => dress summer
[3] => dress floral
[4] => dress prom
[5] => dress modest
[6] => dress cute
// ...
)
*/
from php-pinterest-bot.
Hello @seregazhuk ,
I just try like the figure you show you. And it seems that Pinterest also return "positions" which determine the order to create the complete word. Look at the figure, we have:
- "for teens", position = 1 -> the complete keyword is : "dress for teens"
- "wedding", position = 0 -> the complete keywords is: "wedding dress "
So, I think that position = 0 mean the additional keyword should be putted before the search keyword when make concatenation, and positon = 1 is for the reverse case.
So, If I can, I will suggest that you can return an array of array like for Pins info. One element of array is an array including :
- term
+position
+display - ...
Then if users just want the additional keywords, they just need to get only the "term". Otherwise, If they want to get the complete keyword, they will concatenate it by themselves based on the position.
from php-pinterest-bot.
Hi, @huuvu1109 Oh, I haven't paid attention to the positions. Yes, you are right. I've updated the library. On it returns this:
$keywords = $bot->keywords->recommendedFor('dress');
print_r($keywords);
/*
Array
(
[0] => Array
(
[term] => for teens
[position] => 1
[display] => For Teens
)
[1] => Array
(
[term] => wedding
[position] => 0
[display] => Wedding
)
// ...
)
*/
from php-pinterest-bot.
Hi @seregazhuk ,
It works nicely now. Thanks a lot for your quick response.
from php-pinterest-bot.
@huuvu1109, I am always open for adding new features)
from php-pinterest-bot.
Hello @seregazhuk ,
It's me again. Can you please support to get activities of a specific pin. For example, look at this pin about Eiffel Tower: https://www.pinterest.com/pin/252060910373021697/.
From this pin, we can see all boards pinning the same pin by go to : https://www.pinterest.com/pin/252060910373021697/activity. By this way, we can find interesting boards containing similar pins with the current pin. I think this requires a login.
from php-pinterest-bot.
Hi @huuvu1109
I've implemented it:
foreach ($bot->pins->activity($pinId) as $data) {
//...
}
Yes, it requires login.
If you don't want to get all activity records, you can pass a limit as the second parameter.
Get 5 last activity records:
foreach($bot->pins->activity($pinId, 5) as $activity) {
//...
}
Please notice that with the latest version (4.2.0) api has changed.
Generator objects now return an entity for each iteration, not an array of entities. For example, to
get search results there is no more need to make two nested loops. You can write this:
foreach($bot->pins->search('cats') as $pin) {
echo $pin['id'], "\n";
// ...
}
instead of that:
foreach($bot->pins->search('cats') as $batch) {
foreach($batch as $pin) {
echo $pin['id'], "\n";
// ...
}
}
The same is true about getting followers/following/pins for the user or board and getting pins from source. If you are using these functions please update your code.
As the second parameter to these functions now you can pass a limit for the results:
foreach($bot->pins->search('cats', 2) as $pin) { // ... }
This code above will return only the first 2 pins.
from php-pinterest-bot.
HI @seregazhuk ,
I have tested it. It works very well. Thanks for your quick response.
from php-pinterest-bot.
Hi @seregazhuk ,
I just found that you have already supported the new feature. Now we can use proxy to custom request settings: $bot->getHttpClient()->setOptions([ .....]);
I wonder if you can also support to custom request settings by ssh, I mean send requests through ssh tunnel.
Thanks,
from php-pinterest-bot.
Hi @huuvu1109 , the bot uses curl to make requests. I'm not sure if curl supports ssh tunneling, try to google this issue. It is not related to the bot itself.
from php-pinterest-bot.
@seregazhuk : it seems that curl not supports ssh tunnelling. Thanks!
from php-pinterest-bot.
hi @seregazhuk ,
I just want to ask one question: Is there any way to get the username from email and password. I means I just have the email + password. How can I know what is my username automatically?
from php-pinterest-bot.
Hi @huuvu1109 ,
Yes, update to the latest version (4.9.0) and you can call user->profile()
method without any params, it will return your current user profile:
$profile = $bot->user->profile();
echo $profile['username']; //prints your username
from php-pinterest-bot.
@seregazhuk : got it. thanks!
from php-pinterest-bot.
Hi @seregazhuk ,
can you also support to get newest pins from one pinner to see how often they create pins or not? I think it should be got from https://www.pinterest.com/"username"/pins/.
from php-pinterest-bot.
Hi @huuvu1109
Yes, I've missed it in the documentation. Use this to get the latest pins of a person:
foreach($bot->pinners->pins($username) as $pin) {
// ...
}
To get only 20 last pins:
foreach($bot->pinners->pins($username, 20) as $pin) {
// ...
}
And I will fix my docs.
from php-pinterest-bot.
Got it. thanks @seregazhuk
from php-pinterest-bot.
Hi @seregazhuk ,
Can you add one more function to get the current IP which the bot is working on (because now we can set some options ) as followings:
$bot->getHttpClient()->setOptions([
CURLOPT_PROXY => 'xx.xx.xxx.xx:80',
]);
For me, it is useful because sometimes I need this info for statistical purpose.
I think it can be $bot->getCurrentWorkingIP() and return the current IP of the bot. In the back end, I think we just need to curl with provided proxy to request "http://ipinfo.io/ip" and return the result.
from php-pinterest-bot.
Hi, @huuvu1109
No, because this functionality is not related to Pinterest itself. The bot is about working with Pinterest site, but not checking IP or parsing other sites. The library shouldn't depend on any other third-party sites (http://ipinfo.io/ip).
If you need to check you ip, you should implement it yourself. Or you can use Pinterest client context, which it provides with every request. This is an array with a lot of your client information (os, browser, ip and other).
Check this:
$clientInfo = $bot->getClientInfo();
print_r($clientInfo);
from php-pinterest-bot.
Got it. thanks!
from php-pinterest-bot.
Hi @seregazhuk ,
It seems that the function $bot->pinners->followers($pinnerUserName) doesn't works well in the latest version. It can only return the first follower instead of all followers of a pinner. I have also tried to transform the return value to array but getting the same result.
$result = iterator_to_array ($bot->pinners->followers($pinnerUserName));
Can you please fix this. Thanks!
from php-pinterest-bot.
@huuvu1109 , I've just checked it on random user and it works:
// you can user toArray() method instead of iterator_to_array
$result = $bot->pinners->followers('jearls96')->toArray();
print_r($result);
from php-pinterest-bot.
thanks @seregazhuk , I tested with your example and it works. But for some pinners, it seems to have problem. For example:
$result = $bot->pinners->followers('coreymcintyre65', 0)->toArray();
print_r($result);
For this pinner, by opening it in browsers, we see that it has 7 followers, but by coding it just return the first follower. It seems that there are some followers we can not get by coding, maybe they set up something for their account:
from php-pinterest-bot.
@huuvu1109 , you were right, there was a bug in pagination. Now fixed in version 5.1.4
from php-pinterest-bot.
it works well now. Thanks!
from php-pinterest-bot.
Hi @seregazhuk ,
Can you please also add a new feature: confirm pinterest account. The input will be the confirmation link (the users receive this in their email). I think it is something looks like this:
$bot->pinners->confirmAcc('confirmUrl');
Thanks,
from php-pinterest-bot.
Hi, @huuvu1109
Yes, you can confirm your account like this:
// After registration you will receive a confirmation email. You can pass a link from this email to
// confirmEmail method:
$bot->auth->confirmEmail($linkFromEmail);
from php-pinterest-bot.
oh. I didn't see it before. Got it. Thanks!
from php-pinterest-bot.
Related Issues (20)
- Create APP and Get Token
- Problem to create a new pin HOT 6
- [Invalid email.] When Registering Pinterest
- Здравствуйте.
- Registration error: Invalid parameters. HOT 2
- account banned HOT 1
- how can be scheduled images to go live at a later date on pinterest using api in php? HOT 1
- Keywords recommend not working anymore HOT 1
- Can we create a pin with access_token?
- Domain Spam or Blocked Check?
- Error when create acc
- is it possible to add multiple keywords ? HOT 4
- Pinterest rate limits HOT 2
- Get Boards Return Empty
- Observing the PhP Fatal Error again with the v5.9.1 HOT 9
- Can you please help me to use the edit command ?
- Your requirements could not be resolved to an installable set of packages.
- Autoloader issue
- Login method not working HOT 9
- Is this project dead? Cannot connect Pinterest Account.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-pinterest-bot.