Skip to content

Instantly share code, notes, and snippets.

@apeckham
Created May 29, 2012 21:56
Show Gist options
  • Save apeckham/2831042 to your computer and use it in GitHub Desktop.
Save apeckham/2831042 to your computer and use it in GitHub Desktop.
groupme fetch image urls
require 'httparty'
require 'ap'
$url = ARGV.shift
$cookie = ARGV.shift
raise unless $url && $cookie
class Client
include HTTParty
def self.messages(before_id)
get("#{$url}&before_id=#{before_id}", headers: {"Cookie" => $cookie})
end
end
before_id = nil
begin
json = Client.messages(before_id)
before_id = json['response']['messages'].last['id']
puts json['response']['messages'].map { |row| row['picture_url'] }.compact
end while before_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment