pulse-downloader 0.1.27 → 0.1.28
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a9e6c9185000eb45fe03fcf5ec6739aa0b4df48cd9733654cc2f312ca156b54
|
4
|
+
data.tar.gz: f03dfbbbecbd75ffe795b194c0ac19689021e1a74a4668ffb6573b6193eb0627
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 706da41a31ad0fda7b4a17b748f8271f758973510039d2e3eac79115761ef71e970eee042d3ef30ed2a080ae7e64f49584d8110c249022a4bca3029c48cc1024
|
7
|
+
data.tar.gz: 97c3c92845700c69343eba19fb93a9b9de71fe44ceca0ff986e25df8cc69ffb71a48c778eaa145df4ae802295b148feaee768814c52124e4ca74079e8ca9e807
|
@@ -4,7 +4,7 @@ module Pulse
|
|
4
4
|
def fetch_file_paths(custom_path_root=nil)
|
5
5
|
@start_time = get_micro_second_time
|
6
6
|
|
7
|
-
response = HTTParty.get(url, verify: verify_ssl)
|
7
|
+
response = HTTParty.get(url, verify: verify_ssl, headers: headers)
|
8
8
|
|
9
9
|
@end_time = get_micro_second_time
|
10
10
|
|
@@ -25,10 +25,11 @@ module Pulse
|
|
25
25
|
|
26
26
|
def extract_file_urls(response, custom_path_root, type)
|
27
27
|
return [] if response.body.nil? || response.body.empty?
|
28
|
+
|
28
29
|
remove_base64(
|
29
30
|
extract_all_urls(response, custom_path_root, type) +
|
30
|
-
extract_download_links(response,
|
31
|
-
extract_embedded_images(response,
|
31
|
+
extract_download_links(response, type) +
|
32
|
+
extract_embedded_images(response, type)
|
32
33
|
).uniq
|
33
34
|
end
|
34
35
|
|
@@ -42,17 +43,17 @@ module Pulse
|
|
42
43
|
.map { |link| add_base_url(link) }
|
43
44
|
end
|
44
45
|
|
45
|
-
def extract_download_links(response,
|
46
|
+
def extract_download_links(response, type)
|
46
47
|
parse_html(response.body)
|
47
48
|
.css('a')
|
48
49
|
.to_a
|
49
50
|
.map { |link| link['href'] }
|
50
51
|
.compact
|
51
|
-
.select { |link| (link.include? type
|
52
|
+
.select { |link| (link.include? type) }
|
52
53
|
.map { |link| add_base_url(link) }
|
53
54
|
end
|
54
55
|
|
55
|
-
def extract_embedded_images(response,
|
56
|
+
def extract_embedded_images(response, type)
|
56
57
|
return [] unless scrape_images
|
57
58
|
|
58
59
|
parse_html(response.body)
|
@@ -60,7 +61,7 @@ module Pulse
|
|
60
61
|
.to_a
|
61
62
|
.map { |e| e["src"] }
|
62
63
|
.compact
|
63
|
-
.select { |link| (link.include? type
|
64
|
+
.select { |link| (link.include? type) }
|
64
65
|
.map { |link| add_base_url(link) }
|
65
66
|
end
|
66
67
|
|