or, How to write a Medium article-writing AI bot
Motivation
I like Medium, don’t get me wrong. I think it is an amazing platform filled with tonnes of the best internet journalists and writers in the world. I’ve enjoyed reading the articles that have been in my news feeds, or the results of google searches, for many years.
But I’ve just recently joined the platform and the quality of what I’m reading on Medium had dropped radically. I don’t think there are fewer quality Medium articles. I think it is just that because I joined medium to practice writing, the algorithm quickly realised that and is feeding me articles about writing. All of which are written by aspiring writers, who are like myself but better, and all of which have learned a formulaic approach to creating Medium articles daily. The stories are becoming very samey.
It got me thinking that an AI could probably write some of my articles for me .. just for those days when I can’t quite manage even the 10 minutes to post up a quick brain dump, like yesterday in the doctors waiting room.
Approach
I doubt Medium has an API … just checking … nope, although it does allow importing from another blogging platform.
So, the approach will be to create a script which does the following :
- choose todays topical subject and content by looking at trending news
- use the top story summary as seed text for an AI to generate an article
- get an appropriate photo from unsplash by searching using keywords
- publish the article to a blogging platform, and spit out the URL
And then the only manual step will be to go to the medium import page and paste in the URL that my medium script wrote for me. That step could probably also be automated too actually, but I’m going to call that out-of-scope for now.
The tools
- The google news API : https://newsapi.org/s/google-news-api
- The OpenAI bot : https://github.com/openai/gpt-2
(based on the work byRadford, Alec and Wu, Jeff and Child, Rewon and Luan, David and Amodei, Dario and Sutskever, Ilya
, and able to be tested out easily for yourself at the following website : https://talktotransformer.com/) - The unsplah API : https://unsplash.com/developers
- I’ll use blogger.com as my blogging platform; it had an appropriate API : https://developers.google.com/blogger/docs/3.0/using#AddingAPost
I don’t think there is too much more to say in terms of describing this now .. I’ve still got an hour and a half before my morning walk, I’m going to get to coding this and I’ll just report any major challenges or gotchas here ….
The code
https://github.com/krisrandall/medium-article-writing-bot
The status
At the time of posting this article, only step one is complete.
I’ll update the article if and when I update the code.