mispy-archive / ebooks_example Goto Github PK
View Code? Open in Web Editor NEWExample of a full twitter_ebooks bot definition
Example of a full twitter_ebooks bot definition
Hey! :)
So I just updated ebooks from v2.2.5 to v3.1.0 and I've updated the configurations to the new versions as well (from what I can see on the github file)
I'm getting this whenever I try ebooks tweet model/name.model botname
Building: sentence 0 of 1228
/var/lib/gems/2.1.0/gems/twitter_ebooks-3.1.6/bin/ebooks:247:in `tweet': undefined method `configure' for nil:NilClass (NoMethodError)
from /var/lib/gems/2.1.0/gems/twitter_ebooks-3.1.6/bin/ebooks:412:in `command'
from /var/lib/gems/2.1.0/gems/twitter_ebooks-3.1.6/bin/ebooks:429:in `<top (required)>'
from /usr/local/bin/ebooks:23:in `load'
from /usr/local/bin/ebooks:23:in `<main>'
Is there a solution, or have I done something wrong?
https://twitter.com/Helenderson/status/523883553936113666
Basically, people would follow a bot, then immediately unfollow it so that the bot would favourite their tweets based on the hardcoded keywords.
To counter this, I disabled the hardcoded keywords and added a task that cleans out the followers once every hour. https://github.com/zhuowei/is_like_a
If you want to keep the hardcoded faves, maybe listen to unfollow events from the stream and unfollow back to avoid this?
I'm getting a "Can't assign requested address" issue- every time it tweets and periodically in between. bots.rb
is unexceptional, just the standard boilerplate with keys and timing changed. The other thing is that it can tweet but it can't respond to tweets or DMS- so I'm assuming this error is getting in the way. Relevant facts: OSX Yosemite. Any ideas?
@accountname: #<Errno::EADDRNOTAVAIL: Can't assign requested address - connect(2)>
/Library/Ruby/Gems/2.0.0/gems/twitter-5.15.0/lib/twitter/streaming/connection.rb:16:in `initialize'
/Library/Ruby/Gems/2.0.0/gems/twitter-5.15.0/lib/twitter/streaming/connection.rb:16:in `new'
/Library/Ruby/Gems/2.0.0/gems/twitter-5.15.0/lib/twitter/streaming/connection.rb:16:in `stream'
/Library/Ruby/Gems/2.0.0/gems/twitter-5.15.0/lib/twitter/streaming/client.rb:119:in `request'
/Library/Ruby/Gems/2.0.0/gems/twitter-5.15.0/lib/twitter/streaming/client.rb:92:in `user'
/Library/Ruby/Gems/2.0.0/gems/twitter_ebooks-3.1.0/lib/twitter_ebooks/bot.rb:348:in `start'
/Library/Ruby/Gems/2.0.0/gems/twitter_ebooks-3.1.0/bin/ebooks:308:in `block (3 levels) in start'
/Library/Ruby/Gems/2.0.0/gems/twitter_ebooks-3.1.0/bin/ebooks:306:in `loop'
/Library/Ruby/Gems/2.0.0/gems/twitter_ebooks-3.1.0/bin/ebooks:306:in `block (2 levels) in start'
@accountname: Sleeping before reconnect
My bot was working properly, but just a few hours ago had I received a 401 error. Unable to find the problem, I ran:
rvm implode
gem uninstall rvm
and reinstalled my whole Ruby system so it's brand new. Now, whenever I try to get an archive of a user's tweets, it still returns the same error, which is below:
Erics-MacBook-Pro:ebooks_example eric$ ebooks archive epsund corpus/epsund.json
New archive for @epsund at corpus/epsund.json
/Users/eric/.rvm/gems/ruby-2.1.3/gems/twitter-5.13.0/lib/twitter/rest/response/raise_error.rb:15:in `on_complete': Could not authenticate you. (Twitter::Error::Unauthorized)
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/faraday-0.9.0/lib/faraday/response.rb:9:in `block in call'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/faraday-0.9.0/lib/faraday/response.rb:57:in `on_complete'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/faraday-0.9.0/lib/faraday/response.rb:8:in `call'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/faraday-0.9.0/lib/faraday/request/url_encoded.rb:15:in `call'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/faraday-0.9.0/lib/faraday/request/multipart.rb:14:in `call'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/twitter-5.13.0/lib/twitter/rest/request/multipart_with_file.rb:17:in `call'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/faraday-0.9.0/lib/faraday/rack_builder.rb:139:in `build_response'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/faraday-0.9.0/lib/faraday/connection.rb:377:in `run_request'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/faraday-0.9.0/lib/faraday/connection.rb:140:in `get'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/twitter-5.13.0/lib/twitter/rest/request.rb:33:in `perform'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/twitter-5.13.0/lib/twitter/rest/utils.rb:51:in `perform_request'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/twitter-5.13.0/lib/twitter/rest/utils.rb:96:in `perform_request_with_objects'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/twitter-5.13.0/lib/twitter/rest/utils.rb:140:in `objects_from_response_with_user'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/twitter-5.13.0/lib/twitter/rest/timelines.rb:49:in `user_timeline'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/twitter_ebooks-3.0.0/lib/twitter_ebooks/archive.rb:76:in `block in sync'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/twitter_ebooks-3.0.0/lib/twitter_ebooks/archive.rb:74:in `loop'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/twitter_ebooks-3.0.0/lib/twitter_ebooks/archive.rb:74:in `sync'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/twitter_ebooks-3.0.0/bin/ebooks:150:in `archive'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/twitter_ebooks-3.0.0/bin/ebooks:322:in `command'
from /Users/eric/.rvm/gems/ruby-2.1.3/gems/twitter_ebooks-3.0.0/bin/ebooks:339:in `<top (required)>'
from /Users/eric/.rvm/gems/ruby-2.1.3/bin/ebooks:23:in `load'
from /Users/eric/.rvm/gems/ruby-2.1.3/bin/ebooks:23:in `<main>'
from /Users/eric/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `eval'
from /Users/eric/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `<main>'
I've attempted redoing this process with rvm 1.9.3, 2.0.0, and 2.1.3, but no luck. It keeps giving this error. These are all the commands I've ran to this point:
git clone https://github.com/mispy/ebooks_example.git
bundle install
gem install twitter_ebooks
rvm use 2.1.3
//then, populated bots.rb with correct access key/tokens and consumer key/secrets for the BOT'S ACCOUNT.
ebooks archive epsund corpus/epsund.json
Is there something I'm missing?
Thanks.
special
is checked in two ways which can lead to the bot trying to favourite repeatedly
The first is at line 68, the second at line 81
Repeated attempts to favourite result in a crash (mispy-archive/twitter_ebooks#19)
Using your example on a Heroku-App (rb 2.4.1) crashes when it tries to read the model.
On my local machine (rb 2.4.1) it runs perfectly.
I don't know what the dump format error(0x27)
wants to tell me.
2017-10-15T13:59:47.919742+00:00 app[worker.1]: bundler: failed to load command: ebooks (/app/bin/ebooks)
2017-10-15T13:59:47.919896+00:00 app[worker.1]: ArgumentError: dump format error(0x27)
2017-10-15T13:59:47.919897+00:00 app[worker.1]: /app/lib/twitter_ebooks/model.rb:49:in `load'
2017-10-15T13:59:47.919897+00:00 app[worker.1]: /app/lib/twitter_ebooks/model.rb:49:in `block in load'
2017-10-15T13:59:47.919898+00:00 app[worker.1]: /app/lib/twitter_ebooks/model.rb:48:in `instance_eval'
2017-10-15T13:59:47.919899+00:00 app[worker.1]: /app/lib/twitter_ebooks/model.rb:48:in `load'
2017-10-15T13:59:47.919900+00:00 app[worker.1]: bots.rb:127:in `load_model!'
2017-10-15T13:59:47.919900+00:00 app[worker.1]: bots.rb:33:in `on_startup'
2017-10-15T13:59:47.919901+00:00 app[worker.1]: /app/lib/twitter_ebooks/bot.rb:371:in `fire'
2017-10-15T13:59:47.919901+00:00 app[worker.1]: /app/lib/twitter_ebooks/bot.rb:353:in `prepare'
2017-10-15T13:59:47.919916+00:00 app[worker.1]: /app/bin/ebooks:361:in `block (2 levels) in start'
The bot crashes if it attempts to reply to a DM from someone who doesn't follow it:
/var/lib/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/response/raise_error.rb:21:in `on_complete': You cannot send messages to users who are not following you. (Twitter::Error::Forbidden)
from /var/lib/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/response.rb:9:in `block in call'
from /var/lib/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/response.rb:57:in `on_complete'
from /var/lib/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/response.rb:8:in `call'
from /var/lib/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/request/url_encoded.rb:15:in `call'
from /var/lib/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/request/multipart.rb:14:in `call'
from /var/lib/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/request/multipart_with_file.rb:14:in `call'
from /var/lib/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/rack_builder.rb:139:in `build_response'
from /var/lib/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/connection.rb:377:in `run_request'
from /var/lib/gems/1.9.1/gems/faraday-0.9.0/lib/faraday/connection.rb:177:in `post'
from /var/lib/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/client.rb:108:in `request'
from /var/lib/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/client.rb:72:in `post'
from /var/lib/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/api/utils.rb:82:in `object_from_response'
from /var/lib/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/api/direct_messages.rb:141:in `direct_message_create'
from /var/lib/gems/1.9.1/gems/twitter_ebooks-2.2.5/lib/twitter_ebooks/bot.rb:144:in `reply'
from /home/dafranke/ebooks_example/bots.rb:30:in `block (2 levels) in initialize'
from /var/lib/gems/1.9.1/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `call'
from /var/lib/gems/1.9.1/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
from /var/lib/gems/1.9.1/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'}}}
Sorry if this isn't the best place to have question.
I'm running this on Heroku, and after its first at reply, the bot isn't responding to anything. I checked my logs...
2014-06-11T22:37:30+00:00 heroku[slug-compiler]: Slug compilation finished
2014-06-11T22:37:29.853486+00:00 heroku[api]: Set LANG config vars by [email protected]
2014-06-11T22:37:29.923228+00:00 heroku[api]: Release v4 created by [email protected]
2014-06-11T22:37:29.853554+00:00 heroku[api]: Release v3 created by [email protected]
2014-06-11T22:37:29.923164+00:00 heroku[api]: Deploy 47d0c71 by [email protected]
and then nothing. When I was running it in the console, I got great logging. Any idea what's up here?
Reading json corpus from corpus/username.json
C:/Ruby23-x64/lib/ruby/2.3.0/json/common.rb:156:in `initialize': A JSON text mus
t at least contain two octets! (JSON::ParserError)
What's the issue?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.