instagram_graph_api 0.0.11 → 0.0.12
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/README.md +10 -0
- data/lib/instagram_graph_api/client.rb +1 -1
- data/lib/instagram_graph_api/client/tag.rb +21 -0
- data/lib/instagram_graph_api/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15be12b49a31da27c8d3978f2aaebb969091477d1c4d5e1a842dc4b9fd3f7b54
|
4
|
+
data.tar.gz: 5a20b15b6abf7dbc84cbccecfaecb7fd9ca46978140e6b548104c6e314d5debf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 743679160256cd91df0a4466adea7c5c9bb68c12991c87f855986f758ca9f4de41522fc590b1098beb39fbcfb0419449ca7341963d2996cd98d49380aa180de7
|
7
|
+
data.tar.gz: 03daa42f1f38d45dd5d870f658c83ca44cca73dae56a580652a9143f790ef057f6d590b469c33997ca9ff64253317f86c48bf5c18667a4fc9ddaea27fdd818cc
|
data/README.md
CHANGED
@@ -55,6 +55,16 @@ client.discover_user(USERNAME, fields)
|
|
55
55
|
|
56
56
|
#discover user media, fields can be "caption,media_url,media_type,like_count,comments_count,id"
|
57
57
|
client.discover_user_media(USERNAME, fields)
|
58
|
+
|
59
|
+
#Search for a tag,
|
60
|
+
client.tag_media(page_token, tag_name)
|
61
|
+
#fields can be "media_type,comments_count,like_count,media_url,permalink"
|
62
|
+
fields="media_url,permalink"
|
63
|
+
client.tag_media(page_token, tag_name, fields)
|
64
|
+
#custom edge can be provided, default is 'top_media'
|
65
|
+
tag_media = client.tag_media(page_token, tag_name, edge: "recent_media")
|
66
|
+
# Note: We can run `tag_media.next_page` to fetch next set of results
|
67
|
+
# additional arguent options can also be passed for page params like before/after or any other custom filter
|
58
68
|
```
|
59
69
|
|
60
70
|
## Development
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module InstagramGraphApi
|
2
|
+
class Client
|
3
|
+
module Tag
|
4
|
+
def tag_media(page_token, tag_name, fields = nil, edge: "top_media", options: {})
|
5
|
+
user_id = get_ig_id_from_token(page_token)
|
6
|
+
tag_info = graph_call("ig_hashtag_search?user_id=#{user_id}&q=#{tag_name}")[0]
|
7
|
+
fields ||= "id,media_type,comments_count,like_count,media_url,permalink"
|
8
|
+
query = "#{edge}?user_id=#{user_id}&fields=#{fields}"
|
9
|
+
query += options.reduce(""){|s, (k, v)| s+= "&#{k}=#{v}" }
|
10
|
+
get_connections(tag_info["id"], query)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def get_ig_id_from_token(token)
|
16
|
+
account_info = get_connections('me', "?fields=connected_instagram_account")
|
17
|
+
account_info.dig("connected_instagram_account", "id")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instagram_graph_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rakesh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/instagram_graph_api/client/discovery.rb
|
89
89
|
- lib/instagram_graph_api/client/insights.rb
|
90
90
|
- lib/instagram_graph_api/client/media.rb
|
91
|
+
- lib/instagram_graph_api/client/tag.rb
|
91
92
|
- lib/instagram_graph_api/client/users.rb
|
92
93
|
- lib/instagram_graph_api/version.rb
|
93
94
|
homepage: https://github.com/rakeshpatra/instagram_graph_api
|