GithubHelp home page GithubHelp logo

Comments (9)

seregazhuk avatar seregazhuk commented on July 25, 2024

Hi, @zjzeit
When you are trying to fetch business account boards, are you logged in you business account?
I've just created a secret board and it was returned only if I was logged in this account. For other accounts it stays invisible.

from php-pinterest-bot.

zjzeit avatar zjzeit commented on July 25, 2024

I am logged into the business account. To verify: I was able to pin from a business account to a secret board using the board ID (thus proving the credentials work). That is sufficient for what I need (I can hardcode the secret boardID), I'm just not able to fetch the secret board via boards->forUser(). I'm wondering if Pinterest doesn't respond with secret boards when the query returns > 20 (or some number) of results. Thanks for this awesome code!

from php-pinterest-bot.

seregazhuk avatar seregazhuk commented on July 25, 2024

I cannot reproduce it. I've registered a new business account. Created 88 public and 8 private boards.
All of them can be fetched.
My credentials: [email protected]: secret
Try it yourself:

$bot = PinterestBot::create();
$bot->auth->login('[email protected]', 'secret');

$boards = $bot->boards->forUser('bimutriche');

echo count($boards);  // 96

from php-pinterest-bot.

zjzeit avatar zjzeit commented on July 25, 2024

Ah thanks for the demo! I was able to replicate the issue but realized the issue only existed because I modified your getUser function. The issue was certainly on my end.
Within forUser() I changed the below, which caused the problem.

from
return $this->execGetRequest(['username' => $username], UrlBuilder::RESOURCE_GET_BOARDS);
to
return $this->execGetRequest(['username' => $username,'field_set_key'=>'detailed'], UrlBuilder::RESOURCE_GET_BOARDS);

After undoing that change, I was able to get all the secret boards again.
I made the change because I needed more board information from the request (I needed all board image_cover_urls and pin_counts, but wanted to only make 1 query), but this resulted in only grabbing public boards.

If you have a way to grab all of a user's boards (including extra data like the image_cover_url and pin_count), that would be awesome. Sorry to post an issue that was really my own issue [:

from php-pinterest-bot.

seregazhuk avatar seregazhuk commented on July 25, 2024

Oh, I see. I'll research it. Now you can use this

$bot->boards->info('username', 'boardname');

to get board detail information.

from php-pinterest-bot.

zjzeit avatar zjzeit commented on July 25, 2024

Gotcha. That would involve iterating through each board as in:

for ($bot->boards->forUser('username') as $board)
{
   $bot->boards->info($board['name']); // note: replace key with whatever key gives the board name
}

Calling info() on each instance would be a lot of URL requests to Pinterest. I was hoping to avoid that many requests, No need to research it on my account! (Unless you are just curious, which I definitely understand). I have accomplished what I need.

from php-pinterest-bot.

seregazhuk avatar seregazhuk commented on July 25, 2024

@zjzeit
Was field_set_key the only change you made?
I've updated the method like you:

    /**
     * Get boards for user by username.
     *
     * @param string $username
     *
     * @return array|bool
     */
    public function forUser($username)
    {
        $options = [
            'username' => $username,
            'field_set_key'=>'detailed',
        ];
        return $this->execGetRequest($options, UrlBuilder::RESOURCE_GET_BOARDS);
    }

And it still returns all the boards. Do you have any ideas with your issue behaviour?

from php-pinterest-bot.

zjzeit avatar zjzeit commented on July 25, 2024

Yeah it's weird: because I cannot replicate the issue with a generated business account, I don't know how to diagnose it. field_set_key was the only change I made. It's not an issue anymore as I can still get the data I need.

from php-pinterest-bot.

seregazhuk avatar seregazhuk commented on July 25, 2024

Maybe it was an issue on Pinterest side. Anyway, in the next release, I will add 'field_set_key'=>'detailed' as a default behavior for boards-> forUser() method.

from php-pinterest-bot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.