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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 324b61cdfb38a102aaa652885c1a27a991d3bd22
4
- data.tar.gz: 238e4b494f795132cfd0d2de29cc8cd37ad91b01
3
+ metadata.gz: f4d144a650cd045c0628c56bb82b9e0d4ae1781d
4
+ data.tar.gz: 1ab27d639b406360f676ce681ba54f40ba340b66
5
5
  SHA512:
6
- metadata.gz: 9766df2210f81fe9ec35883ac3ab2dcb882083a8c365de3b77aacebfc2ffa9e6f513b626b15398f5147bb4b1897f6151cf1dac24f1ea35afe884cf3f2d9a5e5e
7
- data.tar.gz: 662612ec1b7279c4fda4e9ac4feb705c3cfe58ab7ce720792b89549ed746551d6e98d9e3b73837b6e160c5e629d7bed9c3bd56ac9b7eb31240fbdff1d26ab495
6
+ metadata.gz: bfe69d40fdd7c10f5dd1d0c61647640e8ce41f0366340e749c06673939ed4c31df85a3dadcf92ad5923621e0dcea518e186827feab647e9feac44d018dfd589f
7
+ data.tar.gz: 01d507493097732d51764a268d3bd8f61303a991882a042c519616adefacd8ddab88d14955e61a359ef7065bfe80cbcda989cdbf799639b0f780d0d364197d5c
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # InstagramFeedByHashtag
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/instagram_feed_by_hashtag`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- ## Development
24
+ Usage: Instagramfeedbyhashtag.feed(hashtag, count) # hashtag => string; count => integer.
28
25
 
29
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
+ Example: Instagramfeedbyhashtag.feed('cars', 6) # Returns an JSON with 6 latest pics tagged with 'cars'.
30
27
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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/[USERNAME]/instagram_feed_by_hashtag.
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/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")
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 1..count
40
+ for i in 0..(count.to_i -1)
43
41
  result << parsed_json['media']['nodes'][i]
44
42
  end
45
43
  end
@@ -1,3 +1,3 @@
1
1
  module InstagramFeedByHashtag
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  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.6
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-20 00:00:00.000000000 Z
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: "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 "
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: []