twitter2vk_reposter 0.3 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +5 -0
- data/README.markdown +62 -50
- data/bin/twitter2vk_reposter +9 -1
- metadata +2 -2
data/ChangeLog
CHANGED
data/README.markdown
CHANGED
@@ -1,57 +1,8 @@
|
|
1
1
|
# twitter2vk
|
2
2
|
|
3
|
-
## English
|
4
|
-
Automatic script to repost statuses from Twitter to VK. It also contain in
|
5
|
-
separated package CLI tool to create config and add cron task.
|
6
|
-
|
7
|
-
Warning: config contain session ID for VK, which can be used to get full access.
|
8
|
-
Make sure that outsiders don’t have access to this file.
|
9
|
-
|
10
|
-
By default, reply and statuses with #novk willn’t be reposted to VK (but you may
|
11
|
-
use #vk to repost any status).
|
12
|
-
|
13
|
-
You may install on server only twitter2vk_reposter package and create config
|
14
|
-
on home computer (don’t remember to add cron task). Or you can uninstall
|
15
|
-
twitter2vk after you create config.
|
16
|
-
|
17
|
-
You can follow author @andrey_sitnik to receive last updates info.
|
18
|
-
|
19
|
-
### Install
|
20
|
-
1. Install Ruby and Rubygems. For example, on Ubuntu:
|
21
|
-
|
22
|
-
sudo apt-get install rubygems
|
23
|
-
|
24
|
-
2. Install twitter2vk gem:
|
25
|
-
|
26
|
-
sudo gem install twitter2vk
|
27
|
-
|
28
|
-
3. Run master to create config and add crom task:
|
29
|
-
|
30
|
-
twitter2vk
|
31
|
-
|
32
|
-
### Config
|
33
|
-
Config is a YAML files with options:
|
34
|
-
|
35
|
-
* `vk_session` – session ID to access to VK.
|
36
|
-
* `twitter_token`, `twitter_secret` — data to access to Twitter by OAuth.
|
37
|
-
* `exclude` – list of text or regexp patterns to exclude statuses from your VK.
|
38
|
-
Code `:reply` will exclude your replies to another users, `:retweet` will
|
39
|
-
exclude retweets by you.
|
40
|
-
* `include` – list of text or regexp patterns to repost excluded statuses.
|
41
|
-
* `format` – format reposted status. `%status%` will be replaced by status text,
|
42
|
-
`%url%` by status link on Twitter.
|
43
|
-
* `last` — text after `format`. If status will be longer that VK allow,
|
44
|
-
`format` will be trim first. So `last` it useful, to set link to Twitter
|
45
|
-
status.
|
46
|
-
* `retweet` — format of retweet. `%status%` will be replaced by text,
|
47
|
-
`%author%` will be replace by tweet author.
|
48
|
-
* `replace` – list of array with 2 elements to replace text in status. Code
|
49
|
-
`:user_to_url` will replace user name to his Twitter link.
|
50
|
-
* `last_message` – file to contain ID of last reposted message.
|
51
|
-
|
52
3
|
## По-русски
|
53
4
|
|
54
|
-
|
5
|
+
Скрипт для автоматической публикации статусов Twitter’а во В Контакте. Так же
|
55
6
|
в отдельном пакете есть консольная утилита для создания настроек и добавления
|
56
7
|
задачи в cron.
|
57
8
|
|
@@ -68,6 +19,13 @@ Config is a YAML files with options:
|
|
68
19
|
Вы можете последовать за автором @andrey_sitnik, чтобы получать информацию
|
69
20
|
о последних обновлениях.
|
70
21
|
|
22
|
+
Подробная статья — http://habrahabr.ru/blogs/twitter/88386/ .
|
23
|
+
|
24
|
+
### Возможности
|
25
|
+
- Не хранит пароли в настройках.
|
26
|
+
- Поддерживает ретвиты.
|
27
|
+
- Имеет гибкие настройки формата статуса и игнорирования статусов.
|
28
|
+
|
71
29
|
### Установка
|
72
30
|
1. Установите Ruby и Rubygems. Например, для Ubuntu:
|
73
31
|
|
@@ -101,3 +59,57 @@ Config is a YAML files with options:
|
|
101
59
|
* `replace` — список массивов из двух элементов для замены текста в статусе. Код
|
102
60
|
`:user_to_url` заменит имена пользователей на ссылку на их Twitter.
|
103
61
|
* `last_message` — файл, чтобы хранить ID последнего полученного сообщения.
|
62
|
+
|
63
|
+
## English
|
64
|
+
Script to automatically repost statuses from Twitter to VK. It also contain in
|
65
|
+
separated package CLI tool to create config and add cron task.
|
66
|
+
|
67
|
+
Warning: config contain session ID for VK, which can be used to get full access.
|
68
|
+
Make sure that outsiders don’t have access to this file.
|
69
|
+
|
70
|
+
By default, reply and statuses with #novk willn’t be reposted to VK (but you may
|
71
|
+
use #vk to repost any status).
|
72
|
+
|
73
|
+
You may install on server only twitter2vk_reposter package and create config
|
74
|
+
on home computer (don’t remember to add cron task). Or you can uninstall
|
75
|
+
twitter2vk after you create config.
|
76
|
+
|
77
|
+
You can follow author @andrey_sitnik to receive last updates info.
|
78
|
+
|
79
|
+
### Features
|
80
|
+
* Don’t store passwords in config.
|
81
|
+
* Retweet support.
|
82
|
+
* Flexible status format and ignore rules.
|
83
|
+
|
84
|
+
### Install
|
85
|
+
1. Install Ruby and Rubygems. For example, on Ubuntu:
|
86
|
+
|
87
|
+
sudo apt-get install rubygems
|
88
|
+
|
89
|
+
2. Install twitter2vk gem:
|
90
|
+
|
91
|
+
sudo gem install twitter2vk
|
92
|
+
|
93
|
+
3. Run master to create config and add crom task:
|
94
|
+
|
95
|
+
twitter2vk
|
96
|
+
|
97
|
+
### Config
|
98
|
+
Config is a YAML files with options:
|
99
|
+
|
100
|
+
* `vk_session` – session ID to access to VK.
|
101
|
+
* `twitter_token`, `twitter_secret` — data to access to Twitter by OAuth.
|
102
|
+
* `exclude` – list of text or regexp patterns to exclude statuses from your VK.
|
103
|
+
Code `:reply` will exclude your replies to another users, `:retweet` will
|
104
|
+
exclude retweets by you.
|
105
|
+
* `include` – list of text or regexp patterns to repost excluded statuses.
|
106
|
+
* `format` – format reposted status. `%status%` will be replaced by status text,
|
107
|
+
`%url%` by status link on Twitter.
|
108
|
+
* `last` — text after `format`. If status will be longer that VK allow,
|
109
|
+
`format` will be trim first. So `last` it useful, to set link to Twitter
|
110
|
+
status.
|
111
|
+
* `retweet` — format of retweet. `%status%` will be replaced by text,
|
112
|
+
`%author%` will be replace by tweet author.
|
113
|
+
* `replace` – list of array with 2 elements to replace text in status. Code
|
114
|
+
`:user_to_url` will replace user name to his Twitter link.
|
115
|
+
* `last_message` – file to contain ID of last reposted message.
|
data/bin/twitter2vk_reposter
CHANGED
@@ -17,7 +17,7 @@ if ARGV.empty? or '--help' == ARGV.first or '-h' == ARGV.first
|
|
17
17
|
puts 'Usage: twitter2vk_reposter.rb CONFIG'
|
18
18
|
puts 'Repost Twitter statuses to VK.com. Call twitter2vk script to create ' +
|
19
19
|
'config and add cron task.'
|
20
|
-
exit
|
20
|
+
exit 0
|
21
21
|
end
|
22
22
|
|
23
23
|
def check(status, pattern)
|
@@ -86,9 +86,17 @@ default = {
|
|
86
86
|
}
|
87
87
|
config = default.merge(YAML.load_file(ARGV.first))
|
88
88
|
|
89
|
+
missed = %w{twitter_token twitter_secret last_message vk_session} - config.keys
|
90
|
+
if missed
|
91
|
+
STDERR.puts "Config #{ARGV.first} has't required options: " +
|
92
|
+
"#{missed.join(', ')}."
|
93
|
+
exit 1
|
94
|
+
end
|
95
|
+
|
89
96
|
last_message = if File.exists? config['last_message']
|
90
97
|
File.read(config['last_message']).strip
|
91
98
|
end
|
99
|
+
last_message = nil unless last_message =~ /^\d/
|
92
100
|
|
93
101
|
twitter = TwitterOAuth::Client.new(:consumer_key => 'lGdk5MXwNqFyQ6glsog0g',
|
94
102
|
:consumer_secret => 'jHfpLGY11clNSh9M0Fqnjl7fzqeHwrKSWTBo4i8TUcE',
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter2vk_reposter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey "A.I." Sitnik
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-03-
|
12
|
+
date: 2010-03-26 00:00:00 +03:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|