Feeding the Pixels
I use an automated, commercial service(1) to post my photos to Instagram & Facebook (and birdsite, in the past). It's worth it, to me, to be able to shoot, edit, and schedule on the weekend and have posts show up all week long.
Unfortunately, that same service doesn't support ActivityPub. Several people have asked and, maybe, it'll show up later...but it is an impediment to my process. So, I found Instagram2Fedi (https://github.com/Horhik/Instagram2Fedi) (or I2M, from here on) and started building what I wanted.
What did I want? It's not a perfect solution but I wanted a cron job that looks for new Instagram posts and, if it finds them, mirrors them to PixelFed. (There are lots of ways this solution could be better but, as of now, either Instagram doesn't support them or my posting service doesn't.).
So, first, I2M requires you to provide Instagram credentials so that it can login on your behalf to scrape your images & repost them. (In the Fediverse, I can generate an API token like it's 2022...but not so much for IG.). Unfortunately, this didn't work for me -- instead of getting authenticated, I got a challenge that required me to copy a link, go to a browser, paste it, agree that this was, in fact, me, and...by that time, I2M had failed out. Endless loop.
After a lot of reading, testing, and playing, I realized something important: IG doesn't require credentials the first time you browse. You can do that anonymously. It's only after you've browsed over some threshold that it'll require a login. So, even though I'm not exactly a Python programmer, I started poking at I2M and made the credentials optional.
This led to my second problem...as written, I2M wants to run continuously. Scrape, post, sleep, scrape post, sleep. while True:
. So, I added a new config option to say, hey, I really only want to run this once.
Now I had what I wanted. If I was a normal geek, I would've added that to crontab and called it a day...but I haven't spent the last few years in Kubernetes for nothing. All the automation around here happens on the k8s cluster and this is not going to be an exception. Spent a bit of time putting it together and, now, a job runs once an hour to see if I've posted anything to IG. If I have, it magically appears in @Neilcar@pixelfed.social.
I've submitted a pull request for all the changes to I2M and, if anybody else would benefit from sharing the k8s YAML, I'm happy to clean that up & add it to.
#PixelFed #instagram #automation #photosharing #RubeGoldberg #Instagram2Fedi @horhik
#instagram #automation #photosharing #rubegoldberg #instagram2fedi #pixelfed