instagram_feed_by_hashtag 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 099ab3f58f8f33426075889309b14ff5edbf2b44
4
- data.tar.gz: 634d5caaaae8c2c0df9c5b2b36d713061f70b037
3
+ metadata.gz: 781862c2afccd48c5e2e98324318e07e58ad4cb5
4
+ data.tar.gz: 0c9c19e45b778d6557eb4d240e287e34769ebf04
5
5
  SHA512:
6
- metadata.gz: f91ca2d0315e64c981d68afb458cd6fbf4e1f784ceb265ed1765f162a218fff95f83ab2793541f7b337618fd6fdd036d960f1f7b9f64d5b02a0880ed040598ff
7
- data.tar.gz: b6aec60cf1169e5cc6ce37196552f791f001d88c0470a5c17c1f27e2667a6509cf251eafec548cbafbaae7bc28e1a9f6f87151cbb0e0cac4fa571bcda52712e1
6
+ metadata.gz: 0444729e0313edc75f657aac82e55c77754943afa2eee82f87dff54a3e3133368362aedda536f09d347129c0cb00a05033d927bf6aa201777b2de6393c0d1dd1
7
+ data.tar.gz: 77ac49b997dfb94405f13c2e371fc0e8d132c948a933c55588bc86c2be398e40a4abc5a14f3731d82a0354ad025cd461413ac5639a43b286256ce0706e3e6a1b
@@ -10,7 +10,22 @@ 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{Instagram feed by hashtag, returns a JSON, no API authentication needed}
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
25
+
26
+
27
+
28
+ }
14
29
  spec.homepage = ""
15
30
  spec.license = "MIT"
16
31
 
@@ -1,30 +1,5 @@
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
28
3
 
29
4
  module Instagramfeedbyhashtag
30
5
 
@@ -1,3 +1,3 @@
1
1
  module InstagramFeedByHashtag
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
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.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo Prauze
@@ -38,7 +38,16 @@ dependencies:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- description: Instagram feed by hashtag, returns a JSON, no API authentication needed
41
+ description: "Simple Instagram feed by hashtag, returns a JSON, no API authentication
42
+ needed.\n\n\n Usage: Instagramfeedbyhashtag.feed(hashtag,
43
+ count) # hashtag => string; count => integer.\n\n Example:
44
+ Instagramfeedbyhashtag.feed('cars', 6) # Returns an JSON with 6 latest pics tagged
45
+ with 'cars'.\n\n Full example: feed = Instagramfeedbyhashtag.feed(
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 in
50
+ @images\n end\n\n\n\n "
42
51
  email:
43
52
  - eduardoprauze@hotmail.com
44
53
  executables: []