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.
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.
TwitterAPI Python Xserver
--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
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.
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/
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
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/
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.
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
Twitter data can now be posted automatically.
https://np-sys.com/diary/
Recommended Posts