[PYTHON] Migrate Qiita articles to WordPress

Introduction

I tried various things with Migrate Qiita articles to GitHub, but the problem of tags remains, so I wrote a script to migrate to WordPress I did.

My article will be migrated as follows. http://needtec.sakura.ne.jp/wod07672/category/qiita%e3%81%8b%e3%82%89%e3%81%ae%e7%a7%bb%e8%a1%8c/

environment

Server side WordPress 5.3.2

Client side Windows10 Python 3.7.4

Advance preparation

Use the following as a WordPress plugin. ・ WP Githuber MD – WordPress Markdown Editor -Application Passwords

WP Githuber MD adds markdown editor functionality to WordPress. Application Passwords are used to use the REST API. Please refer to Posting articles with images automatically with WordPress for preparations for using the REST API.

Also, get a Qiita access token using the method introduced in Migrating Qiita articles to GitHub.

how to use

(1) Get the script from the following repository https://github.com/mima3/qiita_exporter

(2) Execute the script in the following format.

python qiita_to_wp.py qiita username qiita API key WORDPRESS URLex.https://needtec.sakura.ne.jp/wod07672 WORDPRESS username WORDPRESS ApplicationPassword category name

(3) Since the process will be completed after a while, we will publish the article from the WordPress management screen.

The display will be as follows. image.png

result

Where to compare to the transition to GitHub

・ Tags can be used ・ Since it will be ported to a site that you can manage, it seems to be easy to turn around -Twitter embedding is also displayed.

Task

・ Comment migration (not supported this time, but probably possible) → However, for users with more than 1000 articles, it seems that the upper limit of Qiita API will be exceeded, so it seems necessary to save it in a DB or something and retrieve the rest later. -Error handling. (Although it takes time, it is difficult to redo because error processing is not performed) ・ The link in the article does not work. → GitHub and Qiita have links to the "# title" in the text, but WordPress seems impossible. ・ It is difficult to read articles that exceed 10,000 characters. → Unlike Qiita, there is no table of contents -There are places where the image display is difficult. → Some of them are reduced and displayed due to the aspect ratio, which makes it difficult to see.

Recommended Posts

Migrate Qiita articles to WordPress
Migrate Qiita articles to GitHub
Migrate Qiita articles to GitHub Pages + VuePress
Migrate your own CMS data to WordPress
Migrate Qiita stock and LGTM to "Hatena Bookmark"
[First API] Try to get Qiita articles with Python
Scraping your Qiita articles to create a word cloud
Convert Qiita articles to Jekyll post format for backup
Migrate from requirements.txt to pipenv
Cannot migrate from direct_to_template to TemplateView
Back up Qiita posts to GitHub
Migrate from VS Code to PyCharm