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

Show all comments

Showing thread 5 of 59

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.