Cant Fathom how to extract images from Tumblr module

The data is somewhat dense and also seems to be defined differently in the data returned from the Watch Tumblr module bundle and what parameters are available.

Eg: trying to figure out how I access the photos of a certain size in the data returned from Tumblr, but it appears to be in a nested dynamic array I want the URL from value[3] but cant seem to reference it

1 Like

Hi @NickB

You can use map() function like below:

To get all links - {{map(flatten(map(content;media));url)}}

To get specific link (where width is 640) - {{map(flatten(map(content;media));url;width;640)}}

Regards,
Msquare Automation - Platinum Partner of Make
@Msquare_Automation

Thanks, I tried your suggestion, but nothing is returned.
Here’s how I’m testing:

1 Like

Hi @NickB

the black color shows dead variable. I just typed the name of variables from your screenshot. You need to map the content from your data mappings. and you need to type other variables like media, url, and width with exact name within your array data.

If you still find difficulty, feel free to share the output bundle json from your data.

Regards,
Msquare Automation - Platinum Partner of Make
@Msquare_Automation

Hmm Ok I tried this:

{{map(flatten(map(8.content; 8.content.media)); 8.content.media.url; 8.content.media.width; 640)}}
And it didnt work either,m
So maybe easier if I share the bundle - thanks very kind of you to offer

[
    {
        "type": "blocks",
        "original_type": "photo",
        "is_blocks_post_format": false,
        "blog_name": "myblogname",
        "blog": {
            "name": "myblogname",
            "title": "myblogname",
            "description": "",
            "url": "XXXXX,
            "uuid": "t:S_0XDwghJmBhg6ZApxYmvg",
            "updated": "2024-11-20T23:05:20.000Z",
            "tumblrmart_accessories": {},
            "can_show_badges": true
        },
        "id_string": "767708543701991424",
        "is_blazed": false,
        "is_blaze_pending": false,
        "can_ignite": false,
        "can_blaze": false,
        "post_url": "XXXX",
        "slug": "game-changer-deals-enter-code-bf24-during-checkout",
        "date": "2024-11-20T23:05:19.000Z",
        "state": "published",
        "reblog_key": "NqzJ2UN0",
        "tags": [
            "BF24"
        ],
        "short_url": "https://XXXXXXX",
        "summary": "My Summary",
        "should_open_in_legacy": true,
        "recommended_source": null,
        "recommended_color": null,
        "followed": false,
        "liked": false,
        "note_count": 0,
        "source_url": "https://XXXX",
        "source_title": "XXXX",
        "content": [
            {
                "type": "image",
                "media": [
                    {
                        "media_key": "432686b4b20a02dc61fbd2cc3df42856:3a30506e4ac75e15-60",
                        "type": "image/jpeg",
                        "width": 1300,
                        "height": 625,
                        "url": "https://64.media.tumblr.com/432686b4b20a02dc61fbd2cc3df42856/3a30506e4ac75e15-60/s2048x3072/85cc0dac4d9fa4695d6c4a2ee59eb0c758d624cc.jpg",
                        "colors": {
                            "c0": "000942",
                            "c1": "050a24"
                        },
                        "has_original_dimensions": true
                    },
                    {
                        "media_key": "432686b4b20a02dc61fbd2cc3df42856:3a30506e4ac75e15-60",
                        "type": "image/jpeg",
                        "width": 1280,
                        "height": 615,
                        "url": "https://64.media.tumblr.com/432686b4b20a02dc61fbd2cc3df42856/3a30506e4ac75e15-60/s1280x1920/908c5ca4faaaf3c422ab627bcb5f4548ba3a678a.jpg",
                        "colors": {
                            "c0": "000942",
                            "c1": "050a24"
                        }
                    },
                    {
                        "media_key": "432686b4b20a02dc61fbd2cc3df42856:3a30506e4ac75e15-60",
                        "type": "image/jpeg",
                        "width": 640,
                        "height": 308,
                        "url": "https://64.media.tumblr.com/432686b4b20a02dc61fbd2cc3df42856/3a30506e4ac75e15-60/s640x960/c1db0e289757cb913bccbc5923ef1f2264c05a73.jpg",
                        "colors": {
                            "c0": "000942",
                            "c1": "050a24"
                        }
                    },
                    {
                        "media_key": "432686b4b20a02dc61fbd2cc3df42856:3a30506e4ac75e15-60",
                        "type": "image/jpeg",
                        "width": 540,
                        "height": 260,
                        "url": "https://64.media.tumblr.com/432686b4b20a02dc61fbd2cc3df42856/3a30506e4ac75e15-60/s540x810/1dfb5f060c0ef76bb0d86039c16b0c1516e50b60.jpg",
                        "colors": {
                            "c0": "000942",
                            "c1": "050a24"
                        }
                    },
                    {
                        "media_key": "432686b4b20a02dc61fbd2cc3df42856:3a30506e4ac75e15-60",
                        "type": "image/jpeg",
                        "width": 500,
                        "height": 240,
                        "url": "https://64.media.tumblr.com/432686b4b20a02dc61fbd2cc3df42856/3a30506e4ac75e15-60/s500x750/3fa4329623fdf4879b134ef314b90872cea10068.jpg",
                        "colors": {
                            "c0": "000942",
                            "c1": "050a24"
                        }
                    },
                    {
                        "media_key": "432686b4b20a02dc61fbd2cc3df42856:3a30506e4ac75e15-60",
                        "type": "image/jpeg",
                        "width": 400,
                        "height": 192,
                        "url": "https://64.media.tumblr.com/432686b4b20a02dc61fbd2cc3df42856/3a30506e4ac75e15-60/s400x600/e142a8cc9570d8be0e68ad275637bc9f8e5a2763.jpg",
                        "colors": {
                            "c0": "000942",
                            "c1": "050a24"
                        }
                    },
                    {
                        "media_key": "432686b4b20a02dc61fbd2cc3df42856:3a30506e4ac75e15-60",
                        "type": "image/jpeg",
                        "width": 250,
                        "height": 120,
                        "url": "https://64.media.tumblr.com/432686b4b20a02dc61fbd2cc3df42856/3a30506e4ac75e15-60/s250x400/e54dec64f60ccad89477e0732db670a43a5f467d.jpg",
                        "colors": {
                            "c0": "000942",
                            "c1": "050a24"
                        }
                    },
                    {
                        "media_key": "432686b4b20a02dc61fbd2cc3df42856:3a30506e4ac75e15-60",
                        "type": "image/jpeg",
                        "width": 100,
                        "height": 48,
                        "url": "https://64.media.tumblr.com/432686b4b20a02dc61fbd2cc3df42856/3a30506e4ac75e15-60/s100x200/39ef782601271b819ecd4fc007192e3c249c3e8e.jpg",
                        "colors": {
                            "c0": "000942",
                            "c1": "050a24"
                        }
                    },
                    {
                        "media_key": "432686b4b20a02dc61fbd2cc3df42856:3a30506e4ac75e15-60",
                        "type": "image/jpeg",
                        "width": 75,
                        "height": 75,
                        "url": "https://64.media.tumblr.com/432686b4b20a02dc61fbd2cc3df42856/3a30506e4ac75e15-60/s75x75_c1/fdfe2b763f83a0304961c2ab99ba5154f66d49ed.jpg",
                        "colors": {
                            "c0": "000942",
                            "c1": "050a24"
                        },
                        "cropped": true
                    }
                ],
                "attribution": {
                    "type": "link",
                    "url": "https://gamechangeraudio.acemlna.com/lt.php?x=3DZy~GE7JFPOE5Srzd9HU.Bs3H2hv_9zwxtgkaXFKaOf6HKu0Ey.zudy3I2ojdg~juZAY5HEKU",
                    "url_redirect": "https://gamechangeraudio.acemlna.com/lt.php?x=3DZy~GE7JFPOE5Srzd9HU.Bs3H2hv_9zwxtgkaXFKaOf6HKu0Ey.zudy3I2ojdg~juZAY5HEKU"
                },
                "colors": {
                    "c0": "000942",
                    "c1": "050a24"
                }
            },
            {
                "type": "text",
                "text": "Game Changer deals\nEnter code BF24 during checkout to receive 20% OFF"
            }
        ],
        "layout": [],
        "trail": [],
        "can_like": true,
        "interactability_reblog": "everyone",
        "interactability_blaze": "everyone",
        "can_reblog": true,
        "can_send_in_message": true,
        "muted": false,
        "mute_end_timestamp": 0,
        "can_mute": true,
        "can_reply": true,
        "display_avatar": true,
        "liked_timestamp": null
    }
]
1 Like

Hi @NickB

There is some issue with your data structure that we can check later to use map() function over again. But to get all urls, you can use the function in ietartor and set the filter based on your need.

Regards,
Msquare Automation - Platinum Partner of Make
@Msquare_Automation

1 Like

Thanks for the help, I’m getting somewhere,


but the array it generates is not showing any data

1 Like

Got it! Thanks so much for your help

{{flatten(map(8.content[].media; "url"; "width"; 640))}}
1 Like

Glad to help you @NickB

Regards,
Msquare Automation - Platinum Partner of Make
@Msquare_Automation

OK I have another issue, if the post type is not a photo I want to build the end post differently as the data structure is different.
What I’m doing is iterating over a portion of the data which catches all the values I need, but does result in some empty values:

To get around this I then aggregate the values to a new text variable , as one bundle is empty due to the order of the data being arbitrary.
So then I call the aggregated value in the my final post but because there are two bundles, it is triggered twice:


How do I ensure the final step is only executed once using only the aggregated variable values?

1 Like

Hi @NickB

In aggregator, select the source module as the one who is only consuming 1 operation.

Regards,
Msquare Automation - Platinum Partner of Make
@Msquare_Automation

Thanks, so I can do that in the first variable:


But then the next variable and aggregator does not allow me to access that module so the variable cannot be set:

1 Like

Is this set variable is only consuming 1 operation?? If not, you can choose the source module as for iterator.

Regards,
Msquare Automation - Platinum Partner of Make
@Msquare_Automation