instagram-crawler 0.2.0 → 0.2.1
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/Gemfile.lock +7 -7
- data/lib/instagram_crawler/file.rb +9 -3
- data/lib/instagram_crawler/parser/base.rb +4 -1
- data/lib/instagram_crawler/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e460402bed3e496955845e5920100d7b216edda7a94e5f0635a0f5770fc34a44
|
|
4
|
+
data.tar.gz: 2f51f10e8c9f4f1ff485232169b4b375f9c307b9b95b762fe24e4d8f048a875c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91a28b2486726b71a6dd011845af1c7e2d0f09cbea26f50c86e8b59a285aded39606b98f083c3d43913c894fc0c97e465e6650780652ec5d8e32472cca98a970
|
|
7
|
+
data.tar.gz: 47b5d98b9d12b30fe466e86140ab96dbf3e3359616b7bfd73b9e60e3616145516f45b9e6b962c2f4c95700d2647bb08c481dd3cb3acc54e6d3e7e8b20e311506
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
instagram-crawler (0.2.
|
|
4
|
+
instagram-crawler (0.2.1)
|
|
5
5
|
colorize (~> 0.8)
|
|
6
6
|
http (~> 4.0)
|
|
7
7
|
nokogiri (~> 1.8)
|
|
@@ -9,7 +9,7 @@ PATH
|
|
|
9
9
|
GEM
|
|
10
10
|
remote: https://rubygems.org/
|
|
11
11
|
specs:
|
|
12
|
-
addressable (2.
|
|
12
|
+
addressable (2.6.0)
|
|
13
13
|
public_suffix (>= 2.0.2, < 4.0)
|
|
14
14
|
colorize (0.8.1)
|
|
15
15
|
coveralls (0.8.22)
|
|
@@ -22,7 +22,7 @@ GEM
|
|
|
22
22
|
docile (1.3.1)
|
|
23
23
|
domain_name (0.5.20180417)
|
|
24
24
|
unf (>= 0.0.5, < 1.0.0)
|
|
25
|
-
http (4.
|
|
25
|
+
http (4.1.1)
|
|
26
26
|
addressable (~> 2.3)
|
|
27
27
|
http-cookie (~> 1.0)
|
|
28
28
|
http-form_data (~> 2.0)
|
|
@@ -32,9 +32,9 @@ GEM
|
|
|
32
32
|
http-form_data (2.1.1)
|
|
33
33
|
http_parser.rb (0.6.0)
|
|
34
34
|
json (2.1.0)
|
|
35
|
-
mini_portile2 (2.
|
|
36
|
-
nokogiri (1.
|
|
37
|
-
mini_portile2 (~> 2.
|
|
35
|
+
mini_portile2 (2.4.0)
|
|
36
|
+
nokogiri (1.10.2)
|
|
37
|
+
mini_portile2 (~> 2.4.0)
|
|
38
38
|
public_suffix (3.0.3)
|
|
39
39
|
rake (10.5.0)
|
|
40
40
|
rspec (3.8.0)
|
|
@@ -74,4 +74,4 @@ DEPENDENCIES
|
|
|
74
74
|
rspec (~> 3.0)
|
|
75
75
|
|
|
76
76
|
BUNDLED WITH
|
|
77
|
-
1.17.
|
|
77
|
+
1.17.2
|
|
@@ -9,13 +9,19 @@ module InstagramCrawler
|
|
|
9
9
|
|
|
10
10
|
def download(url, dir_name, file_name)
|
|
11
11
|
return unless Config.download
|
|
12
|
-
|
|
12
|
+
binary_data, mime_type = get_binary_data(url)
|
|
13
|
+
|
|
14
|
+
extname =
|
|
15
|
+
case mime_type
|
|
16
|
+
when "video/mp4" then ".mp4"
|
|
17
|
+
when "image/jpeg" then ".jpeg"
|
|
18
|
+
end
|
|
13
19
|
|
|
14
20
|
dir_path = "#{Config.base_path}/#{dir_name}"
|
|
15
21
|
FileUtils.mkdir_p(dir_path) unless Dir.exist?(dir_path)
|
|
16
22
|
|
|
17
23
|
file_path = "#{dir_path}/#{file_name}#{extname}"
|
|
18
|
-
|
|
24
|
+
|
|
19
25
|
|
|
20
26
|
File.open(file_path, 'wb') do |f|
|
|
21
27
|
f.write binary_data
|
|
@@ -28,7 +34,7 @@ module InstagramCrawler
|
|
|
28
34
|
res = Config.proxyname ?
|
|
29
35
|
HTTP.via(Config.proxyname, Config.port).get(url) : HTTP.get(url)
|
|
30
36
|
raise Errors::HttpError, "#{res.code} #{res.reason}" if res.code != 200
|
|
31
|
-
res.to_s
|
|
37
|
+
[res.to_s, res.mime_type]
|
|
32
38
|
end
|
|
33
39
|
end
|
|
34
40
|
end
|
|
@@ -5,7 +5,10 @@ module InstagramCrawler
|
|
|
5
5
|
|
|
6
6
|
def parse_post(posts, time)
|
|
7
7
|
posts.each.with_index(1) do |post, index|
|
|
8
|
-
url =
|
|
8
|
+
url =
|
|
9
|
+
post["node"]["is_video"] ?
|
|
10
|
+
post["node"]["video_url"] :
|
|
11
|
+
post["node"]["display_url"]
|
|
9
12
|
output(time, url)
|
|
10
13
|
File.download(url, "post/#{time}", "#{index}.#{time}")
|
|
11
14
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: instagram-crawler
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Leon Ji
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2019-03-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -155,8 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
155
155
|
- !ruby/object:Gem::Version
|
|
156
156
|
version: '0'
|
|
157
157
|
requirements: []
|
|
158
|
-
|
|
159
|
-
rubygems_version: 2.7.6
|
|
158
|
+
rubygems_version: 3.0.1
|
|
160
159
|
signing_key:
|
|
161
160
|
specification_version: 4
|
|
162
161
|
summary: The easiest way to download instagram photos, posts and videos.
|