Skip to content

kusuwada/twitter-to-hatena

Repository files navigation

!!!! This program is can't be used on Twitter Free Plan from 2023/3 !!!!

twitter-to-hatena

Post tweets to hatena blog with photos, tags.

Demo

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

twitter

Posted articles

blog

Description

  • 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.

Precautions

Usage

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

from local

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')}

from act

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

The setting of Hatena blog

  • Recommended edit mode: Markdown mode

Limitation

  • Movie or GIF is not exported.
  • The limitation of posting entry number to Hatena Blog is 100 / 24h.

About

Post tweets to hatena blog with photos, tags.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages