[RUBY] Attempts to automatically increase Twitter followers

effect

The transition of the number of followers when the method introduced this time is practiced on the Bot HackathonPortal that automatically informs the hackathon holding information and it is operated for about 45 days is as follows. Will be.

socialdog_dashboard.png

This graph was measured with the Twitter marketing tool SocialDog. The aggregation period will be from 2020/8/15 to 2020/9/29. During this period, the number of followers increased ** 132 **. The number of followers is still increasing. Therefore, it seems that the content that we have practiced this time is effective in increasing the number of followers.

About Hackathon Portal

HackathonPortal is a bot that automatically collects and informs you about the latest hackathon events.

If you haven't followed HackathonPortal yet, please do so!

See here for technical details

In addition, the contents of the actual processing introduced this time are published here. hackathon_portal The process is mainly described in promote.rb, and .gitlab-ci.yml The command that is being executed repeatedly is described in (: //github.com/TakuKobayashi/hackathon_portal/blob/master/.gitlab-ci.yml). (This project runs on Rails) I will explain the detailed code in another article.

We are still doing trial and error, so the logic will continue to change.

Operating environment and how to operate

This time, I will introduce the environment and how to operate the attempt to automatically increase the followers of Twitter.

Operating environment

How to move

First of all, please build an environment where Ruby and Rails work Make Rails and MySQL work together Run the following command to create the database and create the table

rails db:create
rails db:migrate

If it already contains data, execute the following command to reset the data

rails db:migrate:reset

Inject data that is actually working

rails db:seed

All the data that is actually working is managed by Git in the repository seeds The data injected this time is the one managed above and injected into the database.

In order to execute the following commands, it is necessary to register the Twitter API Key and Twitter account information. .env.sample Copy the information to .env and put the Twitter API Key in the following items respectively. Please enter the information for consumer_key and consumer_secret and the information for Twitter account information ʻaccess_token and ʻaccess_token_secret.

.env


TWITTER_CONSUMER_KEY = ""
TWITTER_CONSUMER_SECRET = ""
TWITTER_BOT_ACCESS_TOKEN = ""
TWITTER_BOT_ACCESS_TOKEN_SECRET = ""

Execute the following command to inject new additional data

rails runner Promote.import_twitter_routine!

You can also inject data with the following command. (The purpose of the following command is to get the information of the hackathon event from Twitter, and in the process, we also get the data of the tweet to be liked)

rails runner Event.import_events_from_twitter!

In the injected data, the information of the tweets to be liked from now on is injected. Please execute the following command for the process to like the target tweet

rails runner Promote.like_major_user!

If you want to follow the users who meet the conditions, please execute the following command

rails runner Promote.try_follows!

Execute the following command to unfollow users who meet the conditions.

rails runner Promote.organize_follows!

If you want to write the data currently contained in MySQL to a SQL file, execute the following command.

rails backup:export_active_records_data

We are trying to increase the number of followers on Twitter by executing the commands listed above on a regular basis every day.

Trigger

I referred to the following article

There were several other articles that showed how to get Twitter followers. According to a certain rule, I decided to examine how to increase the number of followers on Twitter by repeating it every day, and at the same time, try to automate these methods.

Also, I decided to apply it to something that leads to improvement of recognition and transmission power by increasing followers, so I tried it with a Hackathon Portal account. → If you find a good trend, I will apply it to my Twitter account.

Automation policy

In order to automate the process and operate it, we searched for a method that can be operated realistically according to various conditions and tried to operate it. After that, I will describe the conditions required for automation and the policy of the processing performed.

hypothesis

Define what you need to do to get more followers on Twitter. As a hypothesis, it is thought that Twitter followers will increase if the following contents are satisfied.

  1. ** Tweet valuable and useful information **
  2. ** Tweet every day as much as possible **
  3. ** Make people who may be interested in the information you are tweeting aware of it (Like the target tweet) **
  4. ** Follow people who may be interested in the information you are tweeting **
  5. ** Get the followers to recognize (like or follow) ** → Because the content that the followers are interested in is likely to be common to the follower users.
  6. ** Unfollow users who are not active or unfollowed ** → If there are too many followers for the number of followers, it seems that the account is just for increasing followers, so followers Unfollow users who are unlikely to contribute to the increase

conditions

Following the hypothesis, we will identify the conditions necessary to realize automation.

  1. Do what you can with the current Twitter API
  2. Automate as long as you don't get too caught up in the Twitter API restrictions
  3. Automate to avoid violating Twitter regulations

Explanation of conditions

First, The story of making an automatic follower acquisition tool on Twitter In the article

③ Follow all users who are your followers and have a large number of followers who are like the latest tweets.

This method cannot be practiced by normal means, as the current Twitter API does not provide information on all users who are like tweets.

We've put together an implementation that doesn't do things that the current Twitter API can't do. Also, follow and like will return an error before reaching the limit described in Twitter's API, so it is necessary to stop today's processing at just the right place to prevent repeated errors. was. (Because API Key and count are frozen if repeated errors are issued) Therefore, I created the process so that it will settle down to the right number of times without causing an error.

Specific implementation policy for automation processing

  1. ** Tweet valuable and useful information every day ** → Originally tweeted information about the hackathon
  2. ** Like the tweets that are tweeting about a specific keyword up to 1000 tweets per day, which is the upper limit of the Twitter API ** → What is a specific keyword This time? Keyword about hackathon: [hackathon OR hackathon OR gamejam OR Ideathon OR Ideathon OR Development training camp OR Hackathon](https://twitter.com/search?q=hackathon%20OR%20%E3%83%83%E3%82%AB%E3% 82% BD% E3% 83% B3% 20OR% 20gamejam% 20OR% 20% E3% 82% A2% E3% 82% A4% E3% 83% 87% E3% 82% A3% E3% 82% A2% E3% 82% BD% E3% 83% B3% 20OR% 20% E3% 82% A2% E3% 82% A4% E3% 83% 87% E3% 82% A2% E3% 82% BD% E3% 83% B3% 20OR% 20ideathon% 20OR% 20% E9% 96% 8B% E7% 99% BA% E5% 90% 88% E5% AE% BF% 20OR% 20% E3% 81% AF% E3% 81% A3% E3% 81% 8B% E3% 81% 9D% E3% 82% 93 & src = typed_query & f = live) I will like all the tweets that came out.
  3. ** Score each user's behavior and follow as many users as you can follow over a certain score (1.0 in total this time) **
  1. ** Approach followers' followers (Like and follow the latest tweets) ** (* This is not implemented)

Twitter regulation

I will list the restrictions of Twitter and the restrictions of Twitter API that I got caught this time below. I tried to increase Twitter followers so as not to get caught in this regulation

Consideration

What I learned from the operation is as follows

  1. ** Likes and followers will not increase the number of followers at once, but will gradually increase **
  2. ** No matter how much you get involved with inactive (not tweeted for a week) users, your followers won't increase, and unfollowing will have little effect **
  3. ** If there is a bug and you can't tweet or like it, your followers won't increase **
  4. ** When retweeted by influencers (users with many followers (approx. 5000)), it will be spread and the number of followers will increase **
  5. ** The number of followers will increase if you make accurate replies and retweets to buzzed tweets that are not shit. → In other words, it entwines well with influencers and buzzed tweets
  6. ** In the end, the number of followers will increase more often if you improve your name recognition by buzzing tweets or somehow **

Notes

Due to the limitations of the Twitter API, it was not possible to make it (as a web service) so that it could be shared by others. In order to practice the same method as introduced here, you must obtain the API Key of the Twitter API. Also, as of 2020, a review is required to obtain the API Key of the Twitter API individually. Please refer to the following to pass the examination and obtain the API Key. Detailed explanation from the example sentence of the 2020 version Twitter API usage application to the acquisition of the API key

the next deployment

  1. Be able to appeal (like, follow) to followers
  2. Consider and implement logic improvements to get good spread
  3. Consideration and implementation of logic for automatic generation of retweets and reply sentences that do not become shit
  4. Apply to your own Twitter account (@taptappun) and operate
  5. Use GAS and Google SpreadSheet to make it work automatically so that others can use it for free and easily.
  6. Make something that can be applied to GAS without writing code

Recommended Posts

Attempts to automatically increase Twitter followers
Save twitter icon to s3