You can only select HTTP URLs:
URI.extract("RT: Something http://path.com/p/123") # => ["RT:", "http://path.com/p/123"] URI.extract("RT: Something http://path.com/p/123", "http") # => ["http://path.com/p/123"]
Your method can also be cleaned up quite a bit, you have many redundant local variables:
def grabTweets Twitter.search("[pic] "+" path.com/p/", :rpp => $a, :result_type => "recent").map do |status| URI.extract(status.text, "http") end end
I also want to strongly discourage the use of the global variable ( $a ).
source share