There you are, thinking “Well, I’ve been posting data on an Instagram feed – might be nice to organise and visualise it a bit differently?”.
No problem – surely there are various ways to query Insta based on hashtags?
Oh. [i]You CAN search Insta for a hashtag, but it only shows you ALL posts with the hashtag – not limited to a particular user. So my choices of “in”, “out” and … Continue reading
No problem – I can probably write a python script to pull the Insta posts, split the post text, and write it somewhere.
Ooh – I could put it in wordpress – that has taxonomy!
I could use the wordpress REST API? That’d work. Just need to give it a username and password…
Oh. To call the API you need to set up an Application User. [ii]ChatGPT told me that to do this I needed to install the Application Users plugin. I suppose when I asked it I didn’t tell it what version of WordPress I was using, but that was deprecated when … Continue reading
Oh. To set one of those up you need your site configured to run under SSL. My dev site is not.
Oh. Because my dev site is running on my Unraid server via Docker [iii] but, a special docker setup that Unraid gives you where you can’t edit/access the Dockerfiles or docker-compose.yml files I’ve got to figure out a bunch of extra bullshit I’m not going to need when I actually come to deploy it. [iv]I described this to one of the guys at work, who said he’d recommend setting it all up in K3s – because, you know, these days in order to get a Python script together to read data from … Continue reading
Somehow managed to force it to let me create an Application Password. But my REST call to create the wordpress post is throwing a 401.
Ah. [v] The instructions suggested to set the Auth header to “Basic username:password” – but neglected to point out that the username:password string then needs to be Base64 encoded. ChatGPT lied to me. [vi] This seemed to be the least surprising bit of information in the whole story.
I got it working, but then thought “Why don’t I use some sort of Timeline plugin to visualise the data on my blog?”, and so set about finding one. Then learned that it stores its data as custom post types… no worries, I’ll just make the API call write those!
Oh. When you define a custom post type you need to configure it to be exposed via the REST API, and that’s done inside the plugin code – so to do it I’ve got to forego automated plugin updates and run a custom version that I manually patch with the 2 extra lines to do what I want.
OK, that’s working now – but it doesn’t use the Post date as the date it bases the timeline on – there’s a custom field for that. I’ll just set that in the REST call then…
Oh. It’s stored as a meta property, so not only do I need to expose it in the REST API as well, I also need to write functions to read & write it.
Got to love software.
Footnotes
↑i | You CAN search Insta for a hashtag, but it only shows you ALL posts with the hashtag – not limited to a particular user. So my choices of “in”, “out” and “open” as hashtags were PARTICULARLY unhelpful. |
---|---|
↑ii | ChatGPT told me that to do this I needed to install the Application Users plugin. I suppose when I asked it I didn’t tell it what version of WordPress I was using, but that was deprecated when it rolled into Core in v5.6. I’m running the latest version, 6.7.1 |
↑iii | but, a special docker setup that Unraid gives you where you can’t edit/access the Dockerfiles or docker-compose.yml files |
↑iv | I described this to one of the guys at work, who said he’d recommend setting it all up in K3s – because, you know, these days in order to get a Python script together to read data from one system and stuff it into another you first need to install and learn how to use Kubernetes. |
↑v | The instructions suggested to set the Auth header to “Basic username:password” – but neglected to point out that the username:password string then needs to be Base64 encoded. |
↑vi | This seemed to be the least surprising bit of information in the whole story. |