pulse-downloader 0.1.41 → 0.1.42
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pulse/downloader/version.rb +1 -1
- data/lib/pulse/downloader/web_page_parser.rb +10 -4
- 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: 73defa92c0a7c2549c36a9ff9b5bb94b8b9cebf2de817c24bebf8d990d9eaaf7
|
4
|
+
data.tar.gz: dffa27233dca1a5a50c1b3ca5142ced965ec7b87cba0655c654db8067c421fd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d8b38aa36bd9fb8a5954872bb3509d31cbe6e2f59fe9963bd8d75a5456ccc858a18cd3e032134bdf5d4a0bb8800d53246dd36ef77958a3001608dbe93895a2a
|
7
|
+
data.tar.gz: 2b8fb4ef00b7b75e03535267d2f35b0fc9ccd2c7b67357d11318a4c03e99003a0022d255eaad978626176099713c59f76c9756e6486c01538c947328f6031926
|
@@ -13,13 +13,13 @@ module Pulse
|
|
13
13
|
|
14
14
|
private
|
15
15
|
|
16
|
-
def fetch_folders(folder_url, custom_path_root)
|
17
|
-
current_paths = extract_hrefs(get_response(folder_url), custom_path_root)
|
16
|
+
def fetch_folders(folder_url, custom_path_root, inner_string)
|
17
|
+
current_paths = extract_hrefs(get_response(folder_url), custom_path_root, inner_string)
|
18
18
|
|
19
19
|
@folder_urls = folder_urls.union(current_paths).uniq.compact
|
20
20
|
|
21
21
|
current_paths.each do |path|
|
22
|
-
fetch_folders(path, nil)
|
22
|
+
fetch_folders(path, nil, inner_string)
|
23
23
|
end
|
24
24
|
|
25
25
|
folder_urls
|
@@ -63,15 +63,21 @@ module Pulse
|
|
63
63
|
).uniq
|
64
64
|
end
|
65
65
|
|
66
|
-
def extract_hrefs(response, custom_path_root)
|
66
|
+
def extract_hrefs(response, custom_path_root, inner_string)
|
67
67
|
parse_html(response.body)
|
68
68
|
.css('a')
|
69
69
|
.map { |link| "/#{link['href']}" }
|
70
70
|
.reject { |link| link == "../" || link == "/../" }
|
71
71
|
.reject { |link| link.include?('.') } # Remove files
|
72
|
+
.map { |link| append_two_paths(inner_string, link) }
|
72
73
|
.map { |link| add_base_url(link, custom_path_root) }
|
73
74
|
end
|
74
75
|
|
76
|
+
def append_two_paths(inner_string, link)
|
77
|
+
return link if inner_string.nil?
|
78
|
+
"#{inner_string}/#{link}"
|
79
|
+
end
|
80
|
+
|
75
81
|
def extract_all_urls(response, custom_path_root, type)
|
76
82
|
parse_html(response.body)
|
77
83
|
.to_s
|