twitter2vk - from Twitter to Vkontakte
twitter2vk - a script for automatically republishing statuses from Twitter to VKontakte. For example, if you still have old friends who do not want to leave VK.
- It does not store passwords , so losing the settings file will not be so scary. Only the session ID in VKontakte and the data for the OAuth-login to Twitter are stored in the settings. Especially relevant for those who use the same password for several services.
- Supports retweets - publishes in VK the statuses of other users that you retweeted.
- Setting the format of statuses and retweets in VK. You can, for example, replace users with links to them or trim the text leaving the link after it in its entirety: “Long tex ... http // twitter.com / my / status / 31337”.
- Rules for the exclusion of statuses . You can specify which statuses will not be published in VK (for example, responses to other Twitter users).
Ideally, the script should be installed on a server that is constantly running, for example, on a VPS or a quiet home media server. But you can use a working machine, but then the status will be republished only when it is turned on (however, they will not be lost).
- We put Ruby and its RubyGems package manager (command for Ubuntu / Debian):
sudo aptitude install rubygems libopenssl-ruby ruby-dev
- Install twitter2vk:
sudo gem install twitter2vk
- We launch the wizard to create the settings and tasks for cron:
If you run the setup wizard again and specify the settings file that has already been created, the wizard will not overwrite them, it will only update the properties for logging in to VKontakte and Twitter.
The wizard for creating the settings and the republishing script are different packages, so the settings can be created on the home computer, and only the republishing
sudo gem install twitter2vk_reposter
script can be installed on the server. Theoretically, the script should work under Windows. But it was tested only under OS of the UNIX type.
Settings are saved in YAML format , but it is quite simple.
For the format of the status of responsible three properties:
last. You can use variables in them:
%status%- status text.
%url%- The status address on Twitter.
%author%- author of the status. It makes sense to use only in retweets.
retweetare used to set the appearance of a regular tweet and retweet, respectively. After that, the text from will be added to them
If the resulting status is more than acceptable in VK (160 characters), then it is truncated first
lastit’s convenient to place a link to a tweet so that it does not get cropped (“Long text ... http // twitter.com / my / status / 31337”).
format: "% status%" retweet: "♺% author%:% status" last: "% url%"
Before publishing to VKontakte, the script can replace the necessary words. For example, remove # before the hash tags or instead of user display the link http://twitter.com/user .
Substitutions are indicated as an array in an array . You can use regular expressions. Instead of an array, you can use code to replace users with links.
replace: - ["#nowplaying", "Now playing:"] - [! ruby / regexp / # (\ w) /, "\ 1"] -: user_to_url
The script uses black and white list of patterns to determine whether to publish the next tweet in VK -
include, respectively. In them you indicate the line or regular expression that should be contained in the text of the tweet.
There are codes for popular tasks:
:reply- A response to another Twitter user.
By default, twitter2vk will not republish answers and tweets containing “#novk” (for example, “When will all my classmates understand what #novk sucks in VKontakte”).
The default whitelist is “#vk”, so if you need a tweet to be published in VKontakte, despite the rules
exclude, you should write something like this: “ user You are right, VKontakte really seriously lags behind Facebook #vk”.
exclude: -: reply - Facebook -! ruby / regexp / \ d \ d \ d \ s? \ $ / include: -: retweet - "In contact with"