instagram_feed_by_hashtag 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/instagram_feed_by_hashtag.gemspec +12 -12
- data/lib/instagram_feed_by_hashtag.rb +25 -0
- data/lib/instagram_feed_by_hashtag/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8d9698670e1d1a6dcde5e4ce347881a812d77d0c
|
|
4
|
+
data.tar.gz: ad57be714ec113e56c9ed48ce0faf5b297d03e30
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 888d1d3778a3ad53096ed5b9676260b07d005abf30129441fffc082bf870514ebe6c3ceb78578043589186160056eaf97b4385d10066fb1b1dcdb539dd86b2b7
|
|
7
|
+
data.tar.gz: 5d0c6150dfe12af7acac0afc7a5270f87ad5340e3d1b5077ac730a018dbe46bf955a6490e34f46ff3190d223d5a44660db48f0e395f3a597d0a465f6434de628
|
|
@@ -10,18 +10,18 @@ Gem::Specification.new do |spec|
|
|
|
10
10
|
spec.email = ["eduardoprauze@hotmail.com"]
|
|
11
11
|
|
|
12
12
|
spec.summary = %q{Instagram feed by hashtag, returns a JSON}
|
|
13
|
-
spec.description = %q{Simple Instagram feed by hashtag, returns a JSON, no API authentication needed
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Usage: Instagramfeedbyhashtag.feed(hashtag, count) # hashtag => string; count => integer
|
|
17
|
-
|
|
18
|
-
Example: Instagramfeedbyhashtag.feed('cars', 6) # Returns an JSON with 6 latest pics tagged with 'cars'
|
|
19
|
-
|
|
20
|
-
Full example: feed = Instagramfeedbyhashtag.feed( 'cars', 6 ) # Make request and store JSON in feed variable
|
|
21
|
-
@images = [] # Define array
|
|
22
|
-
for i in 0..(feed.count - 1) # Loop through feed
|
|
23
|
-
@images << feed[i]['display_src'] unless feed[i].nil? # Grab images URLs and store them in @images
|
|
24
|
-
end
|
|
13
|
+
spec.description = %q{Simple Instagram feed by hashtag, returns a JSON, no API authentication needed.\r\n
|
|
14
|
+
|
|
15
|
+
\r\n
|
|
16
|
+
Usage: Instagramfeedbyhashtag.feed(hashtag, count) # hashtag => string; count => integer.\r\n
|
|
17
|
+
\r\n
|
|
18
|
+
Example: Instagramfeedbyhashtag.feed('cars', 6) # Returns an JSON with 6 latest pics tagged with 'cars'.\r\n
|
|
19
|
+
\r\n
|
|
20
|
+
Full example: feed = Instagramfeedbyhashtag.feed( 'cars', 6 ) # Make request and store JSON in feed variable\r\n
|
|
21
|
+
@images = [] # Define array\r\n
|
|
22
|
+
for i in 0..(feed.count - 1) # Loop through feed\r\n
|
|
23
|
+
@images << feed[i]['display_src'] unless feed[i].nil? # Grab images URLs and store them in @images\r\n
|
|
24
|
+
end\r\n
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
require "instagram_feed_by_hashtag/version"
|
|
2
2
|
|
|
3
|
+
module InstagramFeedByHashtag
|
|
4
|
+
|
|
5
|
+
def self.feed(hashtag, count)
|
|
6
|
+
require 'net/http'
|
|
7
|
+
url = URI.parse("https://www.instagram.com/query/?q=ig_hashtag%28#{hashtag}%29+%7B+media.first%28#{count}%29+%7B+count%2C+nodes+%7B+caption%2C+code%2C+comments+%7B+count+%7D%2C+date%2C+display_src%2C+id%2C+is_video%2C+likes+%7B+count+%7D%2C+owner+%7B+id%2C+username%2C+full_name%2C+profile_pic_url+%7D%2C+thumbnail_src%2C+video_views%2C+video_url+%7D%2C+page_info+%7D+%7D")
|
|
8
|
+
p 'foi o http'
|
|
9
|
+
begin
|
|
10
|
+
resp = Net::HTTP.get(url)
|
|
11
|
+
rescue Errno::ETIMEDOUT, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse => e
|
|
12
|
+
resp = false
|
|
13
|
+
end
|
|
14
|
+
unless resp == false
|
|
15
|
+
p 'vai dar o parse'
|
|
16
|
+
result = []
|
|
17
|
+
parsed_json = JSON.parse(resp)
|
|
18
|
+
p parsed_json
|
|
19
|
+
for i in 1..6
|
|
20
|
+
result << parsed_json['media']['nodes'][i]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
result
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
end
|
|
3
28
|
|
|
4
29
|
module Instagramfeedbyhashtag
|
|
5
30
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: instagram_feed_by_hashtag
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eduardo Prauze
|
|
@@ -39,15 +39,15 @@ dependencies:
|
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '10.0'
|
|
41
41
|
description: "Simple Instagram feed by hashtag, returns a JSON, no API authentication
|
|
42
|
-
needed
|
|
43
|
-
count) # hashtag => string; count => integer
|
|
42
|
+
needed.\\r\\n\n\n\\r\\n\n Usage: Instagramfeedbyhashtag.feed(hashtag,
|
|
43
|
+
count) # hashtag => string; count => integer.\\r\\n\n\\r\\n\n Example:
|
|
44
44
|
Instagramfeedbyhashtag.feed('cars', 6) # Returns an JSON with 6 latest pics tagged
|
|
45
|
-
with 'cars'
|
|
46
|
-
'cars', 6 ) # Make request and store JSON in feed variable\n @images
|
|
47
|
-
= [] # Define array\n for i in 0..(feed.count
|
|
48
|
-
- 1) # Loop through feed\n @images
|
|
49
|
-
feed[i]['display_src'] unless feed[i].nil? # Grab images URLs and store them
|
|
50
|
-
@images\n end\n\n\n\n "
|
|
45
|
+
with 'cars'.\\r\\n\n\\r\\n\n Full example: feed = Instagramfeedbyhashtag.feed(
|
|
46
|
+
'cars', 6 ) # Make request and store JSON in feed variable\\r\\n\n @images
|
|
47
|
+
= [] # Define array\\r\\n\n for i in 0..(feed.count
|
|
48
|
+
- 1) # Loop through feed\\r\\n\n @images
|
|
49
|
+
<< feed[i]['display_src'] unless feed[i].nil? # Grab images URLs and store them
|
|
50
|
+
in @images\\r\\n\n end\\r\\n\n\n\n\n "
|
|
51
51
|
email:
|
|
52
52
|
- eduardoprauze@hotmail.com
|
|
53
53
|
executables: []
|