Migrate Qiita stock and LGTM to "Hatena Bookmark"

Introduction

Some people on Qiita may be using LGTM or stock instead of bookmarks. Considering the world where you don't know what will happen these days, it is a risk to keep bookmarks for only one service.

This time, I will write a script to transfer the LGTM and stock information that I have saved to Hatena Bookmark.

In my case, it was migrated as follows. https://b.hatena.ne.jp/mima3/Qiita/

Qiita stock image.png

Registered Hatena Bookmark image.png

environment

Windows10 Python 3.7.4

Advance preparation

Preparing to run Qiita API

Please refer to the following to get a token for access. https://qiita.com/mima_ita/items/ec33706c20f11a95516a

Preparing to execute the REST API of Hatena Bookmark

Please refer to the following and create a Consumer Key and Consumer Secret to execute the REST API of Hatena Bookmark.

[Use the REST API of Hatena Bookmark](http://needtec.sakura.ne.jp/wod07672/2020/04/02/%e3%81%af%e3%81%a6%e3%81%aa% e3% 83% 96% e3% 83% 83% e3% 82% af% e3% 83% 9e% e3% 83% bc% e3% 82% af% e3% 81% aerest-api% e3% 82% 92% e5% 88% a9% e7% 94% a8% e3% 81% 99% e3% 82% 8b /)

how to use

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

(2) Export LGTM in JSON format

python export_qiita_lgtm.py Qiita ID lgtm.json

(3) Export the stock in JSON format

python export_qiita_stock.py Qiita ID"Qiita access token" stock.json

(4) Register the created JSON in Hatena Bookmark.

python import_hatena_bookmark.py Hatena User ID Hatena Password Hatena Consumer Key Hatena Consumer Secret lgtm.json stock.json

When registering in the bookmark, in addition to the tag that was in the Qiita article, the tag [Qiita] is added and registered.

Commentary

Unfortunately, LGTM cannot be obtained via Qiita's API.

On the page below, there was a pioneer in Getting a list of Qiita likes by scraping, but this is for all articles It seems that it is behaving to check if you are "LGTM" or "stock".

As of April 2020, you can see LGTM article as screen, so this time I analyzed the screen and obtained it.

Of course, due to screen analysis, there is a possibility that it will not work easily due to changes in the specifications of the Qiita screen.

Various summaries

This time, I moved stock and LGTM to Hatena bookmarks. In addition, we will also introduce how to move articles to GitHub and WordPress. doing.

Qiita has useful functions such as edit request, automatic saving, table of contents in the page, etc., but ** the world where you do not know what is **, so everyone will try to find a migration destination by each method. I think it's good.

Recommended Posts

Migrate Qiita stock and LGTM to "Hatena Bookmark"
Link Hatena Bookmark and Yammer
Migrate Qiita articles to GitHub
Migrate Qiita articles to WordPress
Migrate Qiita articles to GitHub Pages + VuePress
Dump SQLite3 data and migrate to MySQL