Lurker News
For my travel site side hustle (beatthatflight.com.au/), I find and publish cheap flights for Australians. Sounds simple, but even if say, someone gave me the flights each day, there's posting the, sometimes to deals sites, as well as then editing it and posting it on my site, and out to social media, and then to specific mailing lists on mailchimp, depending on the source city of the deal, or type of post.

A LOT of that becomes tedious. Mailchimp can auto post to FB/twitter/instagram etc, but even converting the blog post into mailchimp emails gets tiring, as you need to choose a feature photo, the specific mailing list etc.
I'm a selenium guy, so have built some scripts to minimise some of it, but the rush each time of finding a deal still pains me when I think of the tedium ahead of publishing it.
Ideally, my goal would be to submit [to][from][when] to a script and the whole process would be automatic. I can see that selenium could do it, but my goodness, it'd be slow and potentially flaky all via the web UI for those sites.
I'd love suggestions, examples of automation you've done, and tools used?

Comments (229) 59 threads

Earlier comments
dhruvkar4 replies#
>>my goodness, it'd be slow and potentially flaky all via the web UI for those sites

Generally, I've had better luck using undocumented APIs for this kind of stuff. I was a heavy user of Selenium to automate many a task (I work in wholesale construction goods, tons of automations needed everywhere).
But then discovered that using internal APIs (which surprisingly don't change much) is far easier than trying to exception manage changing UIs.
Open up dev tools on your browser and watch the GETS/POSTS as you complete your daily tedium. I use Python (usually just requests and beautifulsoup is enough) to mimic the calls and I have yet to find a use case where I wasn't able to automate something online.
I'm currently developing an SDK for our 18th-century ERP system, which has no API. I've also automated getting shipping container tracking data from a various shipping lines and railroad company websites, many with complicated login processes.
Happy to chat, email in profile.

2rsf#
Good point, using the APIs directly is the also the corner stone of stable test automation
ctrl42 replies#
Yup. I did this with a local Android app, that tells you the gps location of a public bus. I sniffed the http packets, found the requests i needed and made a python script that pinged me at slack when my bus was 5 minutes from my bus stop. Useful when I worked at night.
dhruvkar#
Nice, that's the next step up.

Man-in-the-middle Android apps to discover (sometimes different API backend).
I did the same with a shipping line which turned out to use a SOAP backend.

spikej1 reply#
I'm familiar with the web dev tools, but no clue about mobile. Can you point me in the right direction on how to do the same?

Were you using an android emulator on desktop or there's some way to easily do this on android?

dhruvkar#
I use mitmproxy or charles proxy with an android emulator, with an older version of Android so it allows for a man-in-the middle, without being finicky about certificates.
beatthatflight1 reply#
(Facepalm)

I read your post.
Paused.
Opened up debugger on the site I'm currently selenium-ising.
reloaded.
boom. there it is. The request, and beautiful json response.
So...so..so much simpler.
Thank you, my evening is sorted ;)

dhruvkar1 reply#
Haha.. love it, I'm so glad it helped.

I had the same experience a couple years ago after spending months selenium-ing our ERP software.

beatthatflight1 reply#
finally got to it last evening. 20 minutes of playing with json libraries, and I've got a ~10 line script that runs in under a second and produces output that would have taken probably a minute to run in selenium and occasionally been flaky too.

/starts looking at other APIs to use!
Thanks!

Continue this thread — 1 reply

tech_tuna#
Ha ha, yep. I do this kind of thing all the time.
cpclermont2 replies#
I have 141 custom scripts in my $HOME/bin. Most of it is in bash, but there's a couple of node.js scripts as well.

- I mostly automate my bookkeeping with a set of recurring & dependent taskwarrior tasks and scripts as annotations that I run with taskopen[1]. That's creating a bunch of folders, turning some emails in mutt into PDFs, gathering PDFs from emails, fetching bills with selenium, moving files from $DOWNLOADS into the appropriate bookeeping folder, putting a date on some files, turning the whole thing into a zip file, and sending it to the bookkeeper with mailx.
- I automated the email send of my daily summary to my clients with mailx (so I can send it directly from vim)
- I automated turning screen recordings into thumbnails+mp4 link (since GitHub only supports gifs)
- I automated making before/after screen recordings for when I do noticeable performance improvements (page load/animations)
- I automated booting/killing my development servers
- I automated making PRs with `hub pr` (finding the origin/upstream, putting labels, etc.)
- I bound to a key combo switching to the logs of specific development servers
- I turned my client's time tracking (tempo) into a CLI because I got tired of using the UI to say I worked X hours on that ticket and 7.5 - X on the other. Now I only do `tempo log $ticket1 2h $ticket2 3h $supportTicket rest`
[1]: https://github.com/ValiValpas/taskopen

YourMatt1 reply#
How do you like using Node for CLI? I started playing around with it a couple years ago, and at this point, I don't even consider BASH scripts if they involve the slightest bit of logic. Part of me feels like by going all-in, I'm going to lose touch with my ability to write direct BASH scripts, which are likely to work literally forever. Meanwhile, I expect my Node scripts to have a relatively short lifespan, particularly in that I'm leaning on NPM. It's been so nice though, I've decided it was a worthy tradeoff.
cpclermont#
I've been doing pretty much the same thing. If the logic gets crazy, of if I want lots of subcommands, I'd write it with node & commander. There's only so much you can do with `jq` when it comes to processing JSON.
klohto1 reply#
Would you be willing to share the code for Tempo automation? I am in market for the same thing.
cpclermont1 reply#
Sure! It's in my dotfiles. You can find it here [1].

There's the `excel` subcommand you probably don't need and you'll need to export the JIRA_TEMPO_USER and JIRA_TEMPO_TOKEN variables before running it.
- `JIRA_TEMPO_TOKEN` can be found in the Tempo Settings
- `JIRA_TEMPO_USER` can be found by inspecting the requests sent to tempo from JIRA IIRC.
[1]: https://github.com/charlespwd/dotfiles/blob/master/bin/tempo
EDIT: Confirmed, I found my `JIRA_TEMPO_USER` as the only accountID sent as parameter the POST https://app.tempo.io/rest/tempo-timesheets/5/private/days/se... when booting up the app in JIRA.

klohto#
Thank you! Gonna tweak it a bit but it’s a great base for what I was just looking for :)
martin_a1 reply#
I run Home Assistant with Zigbee devices for automatic lighting at home:

- switch on when I get home and sun is set
- switch on when I'm home and the sun sets
- switch on in the morning, full brightness, coldest color to help waking up (really helps me a lot and is not as stressful as an alarm clock)
- automatically turn light off when I (my smartphone) leave home (not visible in the WLAN for 10 minutes)
Will look into more automations there. Perhaps something about turning the heat up in the bathroom in the morning when the windows are closed (there are sensors for that).
I ran NodeRed on a Raspberry Pi too for some time, but I found that helped me only little. Mainly did logfile analysis through that but did not look into other use cases for me.
For work I've got the de-facto standard for the printing industry, I'm doing everything possible with that.

mnbbrown2 replies#
Interested why you use the coldest colour for waking up? I do the same, but use a sunrise simulation instead that goes from warm to cold.
martin_a#
Hm, maybe it's self inflicted torture. I just feel uncomfortable with the blueish light and will get up quickly to leave that behind me. Maybe I will give your sunrise simulation a try, might work just as well, not sure.
sheepybloke#
Cold light helps you wake up in the morning, since it's more stimulating. That being said, it shouldn't be harsh like midday light; closer to an in between. I've heard it described as more of a green light than blue.
htk5 replies#
I manage a Family Office and do monthly performance presentations with PowerPoint, the slides have an unique design, and updating them every month became extremely tedious and error prone.

I was already looking for an excuse to learn Python and this was perfect.
Instead of recreating the slides I created templates (just the last set of presentations) and update them with info directly queried from the database, using python-pptx and pyodbc.
This isn’t exactly an example of a “tool”, but I think the most important part isn’t really the tool, but to be able to identify what you can automate. How you do it might range from DIY to paying someone to code for you, but the feeling after getting rid of manual processes is great!

cybrox#
From the past 10 years of side projects, I can definitely confirm that the most important skill one could have is recognizing what can be automated, and especially, what is worth the effort of automating. - Your example is definitely a good one!
simbas1 reply#
Check out revealjs.com
excitednumber#
Reveal is good but very hard to recreate ppt slides.
excitednumber#
Nice! I work at a quant fund and we Python-pptx, too.
tohs19#
Also at an FO here, this is great. We started templating everything last year and it’s been a huge relief. Project management in Asana we also turned into templates, things are simple but flow so much easier.

Load more comments