Created
May 6, 2015 16:53
-
-
Save michaelfward/86a59553a64ec9d06830 to your computer and use it in GitHub Desktop.
Pulls image URLs from Tumblr Posts pulled from the API. Programmed for a twitter robot.
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
def get_html file | |
regex = /.*(media.*\.jpg)/ | |
fd = File.open("./img/#{file}", "r") | |
fd.each_line do |line| | |
if (regex =~ line) == 0 | |
data = Regexp.last_match | |
puts data[1] | |
end | |
end | |
end | |
files = Dir.entries('./img') | |
files.each do |file| | |
unless file[0] == '.' | |
get_html file | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment