Medium to WordPress in quirks mode

I love Medium. I am afraid though that it is still a product in its infancy and that after all it is prone to the same issues haunting all social platforms: pollution and dilution of authority. Some people are “influencers” and some are “followers” and that’s that.

Therefore i strongly believe that someone who really enjoys writing should have their own home on the internet. Sadly some of us ignored that home and put everything in here, enchanted by the freshness and good spirit of two years ago. Today we can barely see through so many listicles and the biggest problem of them all showed its ugly head:

Medium is a walled garden! With tall walls.

Seriously Medium girls and guys, that RSS feed in my profile is an unreadable joke and your export is like meant to be useless:

  • heavy nested html with useless tags like canvas or figure which don’t work outside your viewer
  • medium branding everywhere, in the title and tailing the content
  • images default to uber tiny size
  • bloated classes
  • bloated element attributes
  • has all your one liner drafts in the same place

In the beginning there was this amazing feature, the extraordinary feature nobody ever implemented before of exporting to WordPress XML. But being such an exotic and unused thing the team decided to cut it short and built this far better and cooler

WTF graded html zip export email check weird link thing

which should count as “look, its your content, we’re just making sure no way in hell will you ever want to use it somewhere else”. Unless, you’re going to copy and paste text which, mother of god, sometimes cannot be copied because of the freaky way the editor behaves.

Therefore

I am thinking about building this new WordPress plugin for importing the medium zip as posts or pages depending on your preference.


While you were waiting the following happened:

  • extract zip to temp folder
  • list files in the temp folder
  • open each file
  • scrape the following
<title>{YOUR TITLE IS HERE} - exported from Medium</title>
  • remove “- exported from Medium” because CPU time is cheap
  • scrape more with regexp or DOM from here
<section data-field="subtitle">{YOUR SUBTITLE IS HERE}</section>
<section data-field="body">>{YOUR BODY IS HERE}</section>
  • find all images by regexp or DOM
<img src="https://cdn-images-1.medium.com/freeze/max/30/1*bO4IqFf4GeUtGiL7_AS_Wg.png?q=20" {IGNORE CLASS AND DATA ATTTRS LOOK FOR CDN IN SRC}>
  • replace 30 with 300 and q=20 with q=100
  • download all images in wp-uploads/ keeping the shitty name they gave it
  • replace the SRC with your blog’s URI + /wp-uploads/medium prefix
  • bang!

OK, that about covers it. Or not. No idea, this is a flimsy spec.

Anybody else wanna chime in and try that? How about you Medium make this a fun side project and prove you are not an evil jail of ideas? Just sayin’


Look, i even made an empty Git repo 🙂

https://github.com/draganescu/medium2wordpress

Excuse the huge face, that’s the default aggrandizing effect of Medium.