pulse-downloader 0.1.35 → 0.1.39
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 +6 -5
- 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: 755faae63c8f6067194546786b29706989cd48f8245d4ea88ad66e4743071356
|
4
|
+
data.tar.gz: a1dbf88e3b530d5b4cb5d21695a18e88cae2bf9cd60928bc02848926d218ae3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d70c134e4603b189b242e9d6e683e42b609b4b358c5d1c265595f6609fb7506a440833644ec0a3b1168442ed1f89eedea258ee091988f40025076f3d88d68a24
|
7
|
+
data.tar.gz: d13f84a37b875c65ececb27f9d2a4cef7f2fb1ebb029576170b2a86f4ba2f1164381de7c491f5dc5fc64f544383c3073065fce430ab99eac0d1ee6e54d879e89
|
@@ -3,7 +3,7 @@ module Pulse
|
|
3
3
|
module WebPageParser
|
4
4
|
def fetch_file_paths(custom_path_root=nil)
|
5
5
|
if traverse_folders
|
6
|
-
fetch_folders(url).each do |folder_url|
|
6
|
+
fetch_folders(url, custom_path_root).each do |folder_url|
|
7
7
|
fetch_and_parse_response(folder_url, custom_path_root)
|
8
8
|
end
|
9
9
|
else
|
@@ -13,14 +13,14 @@ module Pulse
|
|
13
13
|
|
14
14
|
private
|
15
15
|
|
16
|
-
def fetch_folders(
|
16
|
+
def fetch_folders(folder_url, custom_path_root)
|
17
17
|
current_paths = extract_hrefs(get_response(folder_url), custom_path_root)
|
18
18
|
return unless current_paths.compact.size > 0
|
19
19
|
|
20
20
|
@folder_urls = folder_urls.union(current_paths).uniq.compact
|
21
21
|
|
22
22
|
current_paths.each do |path|
|
23
|
-
fetch_folders(path)
|
23
|
+
fetch_folders(path, custom_path_root)
|
24
24
|
end
|
25
25
|
|
26
26
|
folder_urls
|
@@ -67,8 +67,9 @@ module Pulse
|
|
67
67
|
def extract_hrefs(response, custom_path_root)
|
68
68
|
parse_html(response.body)
|
69
69
|
.css('a')
|
70
|
-
.map { |link| link['href'] }
|
71
|
-
.reject { |link| link == "../" }
|
70
|
+
.map { |link| "/#{link['href']}" }
|
71
|
+
.reject { |link| link == "../" || link == "/../" }
|
72
|
+
.reject { |link| link.include?('.') } # Remove files
|
72
73
|
.map { |link| add_base_url(link, custom_path_root) }
|
73
74
|
end
|
74
75
|
|