Skip to content

Instantly share code, notes, and snippets.

@amosrivera
Created October 6, 2015 10:40
Show Gist options
  • Save amosrivera/6ebb695f219df21f2784 to your computer and use it in GitHub Desktop.
Save amosrivera/6ebb695f219df21f2784 to your computer and use it in GitHub Desktop.
require 'pincers'
require 'aws-sdk'
pincers = Pincers.for_webdriver :chrome
pincers.goto "www.nasa.gov"
menu = pincers.search("#nasa-main-menu > li:contains('Galleries')")
menu.search("a:first").hover
menu.search("a:contains('Image of the Day')").click
pincers.search('.gallery-card:first .inner').click
file = pincers.search("#full-view a[download]").download
# file.store("image.png")
s3 = Aws::S3::Resource.new(
credentials: Aws::Credentials.new('key_id', 'key_secret'),
region: 'us-west-1'
)
object = s3.bucket('bucket_name').object('image.png')
object.put(body: file)
object.public_url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment