Automatically post aggregated Twitter data to WordPress with cron to create the best self-log

This is a post that introduces ideas for your own app.

I often post what I have come up with on Twitter instead of a memo, but since the content is fragmented, it is difficult to look back on it later. However, I don't say whether to post them all together on the blog each time. Therefore, I thought that if I get Twitter posts with API and automatically post them to WordPress, I can log myself on a weekly or several-day basis.

App overview

Use Twitter's API to get the data in Python. Post it from Python with the WordPress xml-rpc interface. Python puts the file on the Xserver and runs it in Cron.

tool

TwitterAPI Python Xserver

flow

--Get Twitter API token --Create a program to get tweets in Python --Create a program to automatically post to WordPress from Python --Install Python on Xserver --Combining the program to get Twitter data and the program to post to WordPress --Run with cron on Xserver

Method

There are many articles that have already been summarized neatly, and there is no point in creating a degraded version of them, so I will explain in the form of commenting while referring to them.

Get Twitter API Token

Twitter tokens take a lot of work. You will be able to use it after applying and waiting on the site called Twitter Developer. It may be that you apply and do something else and wait https://www.itti.jp/web-direction/how-to-apply-for-twitter-api/

Create a program to get tweets

It would be interesting if tokens could be issued. There is a way to use a library like tweety, but this article is too divine. The program is very clean.

https://qiita.com/kyohei_ai/items/243b6f98a31433d2faaf

Create a program to automatically post to WordPress from Python

This is also an interesting place. There are two ways to post WordPress automatically, but like this article, we will use the old xml-rpc.

https://np-sys.com/general/python%E3%81%A7wordpress%E3%81%AB%E8%87%AA%E5%8B%95%E3%81%A7%E6%8A%95%E7%A8%BF%E3%81%99%E3%82%8B%EF%BC%88python-wordpress-xmlrpc%EF%BC%89/

Install Python on Xserver

The original Python in the Xserver cannot be piped due to permissions. So you need to install your own Python. By the way, I will also be able to make an SSH connection Python https://note.com/coeeff/n/neab8acfde97e SSH https://qiita.com/NP_Systems/items/5277827a9ba7805d0811

Then, the program that acquires the witter data and the program that posts to WordPress are combined.

Run with cron on Xserver

Xserver makes it easy to configure Cron. The results are also automatically delivered by email, which is useful. https://www.xserver.ne.jp/manual/man_program_cron.php

What you can do

Twitter data can now be posted automatically.

https://np-sys.com/diary/

Recommended Posts

Automatically post aggregated Twitter data to WordPress with cron to create the best self-log
Easily post to twitter with Python 3
How to create sample CSV data with hypothesis
I tried to save the data with discord
Post youtube soaring title to twitter with python3
Steps to create a Twitter bot with python
Post an article with an image to WordPress with Python
Try to create a battle record table with matplotlib from the data of "Schedule-kun"
How to create a submenu with the [Blender] plugin
Post to your account using the API on Twitter
I tried to automatically post to ChatWork at the time of deployment with fabric and ChatWork Api
I tried to automatically create a report with Markov chain
Create a Mastodon bot with a function to automatically reply with Python
Create a Twitter BOT with the GoogleAppEngine SDK for Python
[Introduction to Python] How to get data with the listdir function
Try to extract the features of the sensor data with CNN