lita-onewheel-unstagram 0.0.1 → 0.0.2
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/lib/lita/handlers/onewheel_unstagram.rb +13 -12
- data/lita-onewheel-unstagram.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa53cf75153cf93611ff5161ad749da3cb23544dac303d84de4811f34540b396
|
4
|
+
data.tar.gz: 7bdd6960730e4435e2ea6335fb02636a28bcb601a12f891f1d8ee083e12fe91e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9b6c2e23ef220f8ea59ebfde607a9ccc3edb2eade22d06373561c93dc8de6a4594c469021281a6ddd24314ecd995f942e3aa5d34d9e0dc829756bf10e5667ee
|
7
|
+
data.tar.gz: '08e6bab1aa41a96f4b884865f1b649ef229673569ed955ea06fabfe950973add2c763203848d8d1a30a22e14b9582a4af03978978c7bbac6f3d4a67cad4d743e'
|
@@ -3,24 +3,25 @@ require 'rest-client'
|
|
3
3
|
module Lita
|
4
4
|
module Handlers
|
5
5
|
class OnewheelUnstagram < Handler
|
6
|
-
route /.*(https:\/\/www.instagram.com\/p
|
6
|
+
route /.*(https:\/\/www.instagram.com\/p\/.*\?igshid)/i, :handle_unstagram
|
7
7
|
|
8
8
|
def handle_unstagram(response)
|
9
|
-
fetch_url = response.matches[0][0]
|
9
|
+
fetch_url = response.matches[0][0].sub /\?igshid.*/, ''
|
10
|
+
|
10
11
|
Lita.logger.info("Fetching #{fetch_url}")
|
11
12
|
|
12
|
-
resp = RestClient.get(fetch_url, user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0')
|
13
|
+
# resp = RestClient.get(fetch_url, user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0')
|
13
14
|
quick_down = fetch_url
|
14
15
|
|
15
|
-
if m = /window._sharedData = ({.*})\;/.match(resp)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
16
|
+
# if m = /window._sharedData = ({.*})\;/.match(resp)
|
17
|
+
# json = JSON.parse m[1]
|
18
|
+
# Lita.logger.info json['entry_data']
|
19
|
+
# Lita.logger.info json['entry_data']['PostPage']
|
20
|
+
# Lita.logger.info json['entry_data']['PostPage'][0]
|
21
|
+
# Lita.logger.info json['entry_data']['PostPage'][0]['graphql']
|
22
|
+
# Lita.logger.info json['entry_data']['PostPage'][0]['graphql']['shortcode_media']
|
23
|
+
# quick_down += " #{json['entry_data']['PostPage'][0]['graphql']['shortcode_media']['display_url']}"
|
24
|
+
# end
|
24
25
|
|
25
26
|
response.reply quick_down
|
26
27
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "lita-onewheel-unstagram"
|
3
|
-
spec.version = "0.0.
|
3
|
+
spec.version = "0.0.2"
|
4
4
|
spec.authors = ["Andrew Kreps"]
|
5
5
|
spec.email = ["andrew.kreps@gmail.com"]
|
6
6
|
spec.description = "Wee li'l instagram dereferencer since... I hate igshids"
|