Created
October 6, 2015 10:40
-
-
Save amosrivera/6ebb695f219df21f2784 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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