Post tweets to hatena blog with photos, tags.
You can post your tweets to Hatena blog in a single article for each day.
The sample of tweet and posted article (archives view).
Tweets
Posted articles
- A day's worth of tweets will be compiled into a single article.
- The hashtag of the tweet is exported as a category.
- Only photo media can be exported to blog.
- The title of blog entry will be "YYYY-MM-DD".
- You have to apply twitter developer with your twitter account, and get your access tokens.
- If you fork this repository and use your github actions, please check the github's terms of service
Required environment
- python >= 3.7
Preparation
- Apply Twitter Developer account and get customer key & access token for OAuth
- Create Hatena accuont and get hatena api-key
daily export
$ git clone git@github.com:kusuwada/twitter-to-hatena.git
$ cd twitter-to-hatena
$ pip install -r requirements.txt
$ export TW_CK={twitter_customer_key}
$ export TW_CKS={twitter_customer_key_secret}
$ export TW_AT={twitter_access_token}
$ export TW_ATS={twitter_access_token_secret}
$ export HT_KEY={hatena_api_key}
$ python daily.py {YYYY-MM-DD} {twitter_username} {hatena_id} {hatena_root_endpoint} {tmp_path} --tz={timezone(Default: 'Etc/UTC')}
batch export
$ git clone git@github.com:kusuwada/twitter-to-hatena.git
$ cd twitter-to-hatena
$ pip install -r requirements.txt
$ export TW_CK={twitter_customer_key}
$ export TW_CKS={twitter_customer_key_secret}
$ export TW_AT={twitter_access_token}
$ export TW_ATS={twitter_access_token_secret}
$ export HT_KEY={hatena_api_key}
$ python batch.py {YYYY-MM-DD} {YYYY-MM-DD} {twitter_username} {hatena_id} {hatena_root_endpoint} {tmp_path} --tz={timezone(Default: 'Etc/UTC')}
- Install nektos/act and setup to your machine.
daily export
$ act -j daily -s TW_CK={twitter_customer_key} -s TW_CKS={twitter_customer_key_secret} -s TW_AT={twitter_access_token} -s TW_ATS={twitter_access_token_secret} -s HT_KEY={hatena_api_key} -P ubuntu-latest=nektos/act-environments-ubuntu:18.04
batch export
- Create
./test/test.event
file
{
"action": "workflow_dispatch",
"inputs": {
"start": "2021-03-01",
"end": "2021-03-10"
}
}
*Chenage start & end date as you like
act workflow_dispatch --eventpath test/test.event -s TW_CK={twitter_customer_key} -s TW_CKS={twitter_customer_key_secret} -s TW_AT={twitter_access_token} -s TW_ATS={twitter_access_token_secret} -s HT_KEY={hatena_api_key} -P ubuntu-latest=nektos/act-environments-ubuntu:18.04
- Recommended edit mode: Markdown mode
- Movie or GIF is not exported.
- The limitation of posting entry number to Hatena Blog is 100 / 24h.