pulse-downloader 0.1.24 → 0.1.25
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 +12 -1
- 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: 48153054f979c1f1ed2e36c211edb598f921b41e6f5e0b71bfd8368eaa4112f3
|
4
|
+
data.tar.gz: 1c831b86a9ead79b51446ed0b911ee54d3b410437d20214fddb57da808a3938a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0a0e5d9dbeca80d2de42ae1e655191e9aa01c557992b141412cd1dfe86751b3e047b951fc2f6bbf28ea487b7bc8f80d1d173d76c129ca38194cda34f894ef7a
|
7
|
+
data.tar.gz: cf2a9d907e5f35a792c4d9b7f89ea0e0a96b50de499ade69b62afe0108857a7324836021b3ba338d22c05744789b8e252db08a1ae36177f3a5f671003bee6a32
|
@@ -26,11 +26,22 @@ module Pulse
|
|
26
26
|
def extract_file_urls(response, custom_path_root, type)
|
27
27
|
return [] if response.body.nil? || response.body.empty?
|
28
28
|
(
|
29
|
-
|
29
|
+
extract_all_urls(response, custom_path_root, type) +
|
30
|
+
extract_download_links(response, custom_path_root, type) +
|
30
31
|
extract_embedded_images(response, custom_path_root, type)
|
31
32
|
).uniq
|
32
33
|
end
|
33
34
|
|
35
|
+
def extract_all_urls(response, custom_path_root, type)
|
36
|
+
parse_html(response.body)
|
37
|
+
.to_s
|
38
|
+
.split(/\s+/)
|
39
|
+
.find_all { |u| u =~ /^https?:/ }
|
40
|
+
.compact
|
41
|
+
.select { |link| (link.include? type || link.include?(custom_path_root)) }
|
42
|
+
.map { |link| add_base_url(link) }
|
43
|
+
end
|
44
|
+
|
34
45
|
def extract_download_links(response, custom_path_root, type)
|
35
46
|
parse_html(response.body)
|
36
47
|
.css('a')
|