beaulebens / keyring-social-importers

A collection of importers which pull your content back from social networks, and into your own WordPress install.
32 stars 17 forks source link

Instagram: Link tagged people properly when they're not mentioned in the caption. #29

Closed beaulebens closed 5 years ago

beaulebens commented 5 years ago

If you're using the Instagram importer and the People & Places plugin, then you'd expect that if you tagged a person in a photo, they'd be tagged as a "Person" on the imported post. Instead, this will only work if you mention them via username in the caption. It might also work if they already exist, but new People are not created properly.

In this photo; https://www.instagram.com/p/BsFVOCmgBbk/ there are multiple people mentioned, and they show up in the API response as follows:

[users_in_photo] => Array
        (
            [0] => stdClass Object
                (
                    [user] => stdClass Object
                        (
                            [username] => akires
                        )

                    [position] => stdClass Object
                        (
                            [x] => 0.5342222222
                            [y] => 0.3244444444
                        )

                )

            [1] => stdClass Object
                (
                    [user] => stdClass Object
                        (
                            [username] => dewizzzle
                        )

                    [position] => stdClass Object
                        (
                            [x] => 0.4542222222
                            [y] => 0.4684444444
                        )

                )

            [2] => stdClass Object
                (
                    [user] => stdClass Object
                        (
                            [username] => makethingsdaily
                        )

                    [position] => stdClass Object
                        (
                            [x] => 0.8045542895
                            [y] => 0.3795555556
                        )

                )

            [3] => stdClass Object
                (
                    [user] => stdClass Object
                        (
                            [username] => taurean_chic
                        )

                    [position] => stdClass Object
                        (
                            [x] => 0.6902057778
                            [y] => 0.3804444444
                        )

                )

        )

but on the imported post, only akires registers (previously created).

This block of code might not be catching them properly, or this block might not be creating new entries properly (perhaps because we only get a username for them?).

beaulebens commented 5 years ago

See also; where the People entries are created in the People & Places plugin.

beaulebens commented 5 years ago

Looks like it is probably because I'm looking for a full_name property to pass as name, but in this data we only have a username.

beaulebens commented 5 years ago

Fixed in a083e3207e95b93aeb47e928852f2a1b13ec2b43 (in the main importer, and in the existing reprocessor, so you can just run the "People tagged or mentioned on Instagram" reprocessor to clean up existing posts).