instagram_feed_by_hashtag 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -8
- data/instagram_feed_by_hashtag.gemspec +1 -16
- data/lib/instagram_feed_by_hashtag.rb +2 -4
- data/lib/instagram_feed_by_hashtag/version.rb +1 -1
- metadata +4 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4d144a650cd045c0628c56bb82b9e0d4ae1781d
|
4
|
+
data.tar.gz: 1ab27d639b406360f676ce681ba54f40ba340b66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfe69d40fdd7c10f5dd1d0c61647640e8ce41f0366340e749c06673939ed4c31df85a3dadcf92ad5923621e0dcea518e186827feab647e9feac44d018dfd589f
|
7
|
+
data.tar.gz: 01d507493097732d51764a268d3bd8f61303a991882a042c519616adefacd8ddab88d14955e61a359ef7065bfe80cbcda989cdbf799639b0f780d0d364197d5c
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# InstagramFeedByHashtag
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Thank you for downloading Instagram feed by hashtag Gem!
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,17 +20,20 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
TODO: Write usage instructions here
|
26
23
|
|
27
|
-
|
24
|
+
Usage: Instagramfeedbyhashtag.feed(hashtag, count) # hashtag => string; count => integer.
|
28
25
|
|
29
|
-
|
26
|
+
Example: Instagramfeedbyhashtag.feed('cars', 6) # Returns an JSON with 6 latest pics tagged with 'cars'.
|
30
27
|
|
31
|
-
|
28
|
+
Full example: feed = Instagramfeedbyhashtag.feed( 'cars', 6 ) # Make request and store JSON in feed variable
|
29
|
+
@images = [] # Define array
|
30
|
+
for i in 0..(feed.count - 1) # Loop through feed
|
31
|
+
@images << feed[i]['display_src'] unless feed[i].nil? # Grab images URLs and store them in @images
|
32
|
+
end
|
32
33
|
|
33
34
|
## Contributing
|
34
35
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
36
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/eduardoprauze/instagram_feed_by_hashtag.
|
36
37
|
|
37
38
|
|
38
39
|
## License
|
@@ -10,22 +10,7 @@ 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
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
}
|
13
|
+
spec.description = %q{Simple Instagram feed by hashtag, returns a JSON, no API authentication needed.}
|
29
14
|
spec.homepage = ""
|
30
15
|
spec.license = "MIT"
|
31
16
|
|
@@ -22,15 +22,13 @@ module InstagramFeedByHashtag
|
|
22
22
|
end
|
23
23
|
result
|
24
24
|
end
|
25
|
-
|
26
|
-
|
27
25
|
end
|
28
26
|
|
29
27
|
module Instagramfeedbyhashtag
|
30
28
|
|
31
29
|
def self.feed(hashtag, count)
|
32
30
|
require 'net/http'
|
33
|
-
url = URI.parse("https://www.instagram.com/
|
31
|
+
url = URI.parse("'https://www.instagram.com/explore/tags/#{hashtag.to_s}/?__a=1'")
|
34
32
|
begin
|
35
33
|
resp = Net::HTTP.get(url)
|
36
34
|
rescue Errno::ETIMEDOUT, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse => e
|
@@ -39,7 +37,7 @@ module Instagramfeedbyhashtag
|
|
39
37
|
unless resp == false
|
40
38
|
result = []
|
41
39
|
parsed_json = JSON.parse(resp)
|
42
|
-
for i in
|
40
|
+
for i in 0..(count.to_i -1)
|
43
41
|
result << parsed_json['media']['nodes'][i]
|
44
42
|
end
|
45
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo Prauze
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,16 +38,8 @@ dependencies:
|
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
description:
|
42
|
-
needed
|
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 "
|
41
|
+
description: Simple Instagram feed by hashtag, returns a JSON, no API authentication
|
42
|
+
needed.
|
51
43
|
email:
|
52
44
|
- eduardoprauze@hotmail.com
|
53
45
|
executables: []
|