pulse-downloader 0.1.36 → 0.1.40
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: 7ffba1e49292d05d10f3abe728ee0bfb1ed0369325fa9c0471cf6d0f544f7474
|
4
|
+
data.tar.gz: d2cb94bed29455b263d7084ff89618a68890afea0f5dee8081f382be833c38dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b377e4d1c43d9fea62cc8076b9727773515af1800cb4cfff97024fd0a1b4b035ccd8f530cc7f6b1dacc266c3ebcea6cf0387ad1bac8c032c3ec7cad9d3e87d5
|
7
|
+
data.tar.gz: 83748fed1670bf0393980f949e129956b2eeb77f2c39f635cab3735cf5e1e51df23c2c2e56596f71ebd9b0410ab2f6f3a6ec82730ceabe9ea44199de87051cc2
|
@@ -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(folder_url)
|
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, path)
|
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
|
|