Hi vvvvorum and guys!
For the third day trying to get photos with instagram. Used HTTML and Json.
json-parser
Every time it turns out some nonsense. Can anyone tell me where to start?
Thanks!
Hi vvvvorum and guys!
For the third day trying to get photos with instagram. Used HTTML and Json.
json-parser
Every time it turns out some nonsense. Can anyone tell me where to start?
Thanks!
Hi!
Look at this link - evvvvil-tweet-engine
There’s even more)))
For this kind of web based stuff like twitter, Instagram and Facebook i find it way more convenient to have a little ruby script running. Could even be launched by a shellexecute. Notice how little code is needed to get it running.
Snippet for instagram (saves images as jpgs - which i guess is actually not allowed but possible anyway):
require "instagram"
require "open-uri"
Instagram.configure do |config|
config.client_id = "ENTER ID"
config.client_secret = "ENTER SECRET"
end
instagram_client = Instagram.client()
tags = instagram_client.tag_search('HASHTAG')
urls = Array.new
for media_item in instagram_client.tag_recent_media(tags[0](0).name)
urls << media_item.images.standard_resolution.url
end
urls.each_with_index do |url, idx|
puts url
path = Dir.pwd + "/#{idx}.jpg"
open(path, 'wb') do |file|
file << open(url).read
end
end
Twitter:
require 'twitter'
- twitter tokens
twitter_config = {
consumer_key: "",
consumer_secret: "",
access_token: "",
access_token_secret: "",
}
tweet_count = 15 #tweet count per search
client = Twitter::REST::Client.new(twitter_config) #client object used for queries
- search options
search_string = "#HASHTAG -rt"
search_options = {
result_type: "recent",
lang: "en",
#since_id: 0,
}
- do some search and print to console
results = client.search(search_string, search_options).take(tweet_count)
results.each do |tweet|
puts tweet.user.screen_name
puts tweet.text
end
Hi @ethermammoth
where you want to insert this instagram script?
Thanks.
this is run in ruby, not vvvv. So you need the ruby environment installed on your machine. here you can find an installer for windows - http://rubyinstaller.org/
Oh thank you!
Now I download and use.
I will write the result later.
Thanks!
I’ve got a few questions:
Just create a txt file. Put the code inside and save it with ending .rb
You can open it from commandline (CMD), if you have added the necessary environment variables. Or even use a shellexecute from within vvvv to run a little .bat file with the line “ruby yoursciptname.rb”
I understand you correctly, if I want to find all the images with the hashtag “Mom”, then need the following code in ruby:
require "instagram"
require "open-uri"
Instagram.configure do |config|
config.client_id = "My ID in Instagram"
config.client_secret = "Mt SECRET in Instagram"
end
instagram_client = Instagram.client()
tags = instagram_client.tag_search('Mom')
urls = Array.new
for media_item in instagram_client.tag_recent_media(tags[0](0).name)
urls << media_item.images.standard_resolution.url
end
urls.each_with_index do |url, idx|
puts url
path = Dir.pwd + "/#{idx}.jpg"
open(path, 'wb') do |file|
file << open(url).read
end
end