pulse-downloader 0.1.28 → 0.1.29
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 +15 -2
- 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: ccce085a74c0c4f7710a6e3c7431b191e77bf313a4219ec08e8cd34e78e3340b
|
4
|
+
data.tar.gz: ad2307a1ed1d368fd53a9fa965d7e864a90a263dac689656c49e8a5f62484d9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 654608db5cd95af6aafde8741864bda84dda783348d0d85baf675418b51c65def47c2ce671910f4313a91c0899784ae92e0d4c6da8e43926fafeaf2053ee2c02
|
7
|
+
data.tar.gz: 520111b61ec241a70321f40707659c09317df3d2b950702be65758bb0a29e6c3bf7880fd7c61e57dafb4450ea2c05b51f834dcb3a2c9ad98ca06f3d61d5c327d
|
@@ -40,7 +40,7 @@ module Pulse
|
|
40
40
|
.find_all { |u| u =~ /^https?:/ }
|
41
41
|
.compact
|
42
42
|
.select { |link| (link.include? type || link.include?(custom_path_root)) }
|
43
|
-
.map { |link| add_base_url(link) }
|
43
|
+
.map { |link| add_base_url(link, custom_path_root) }
|
44
44
|
end
|
45
45
|
|
46
46
|
def extract_download_links(response, type)
|
@@ -65,6 +65,17 @@ module Pulse
|
|
65
65
|
.map { |link| add_base_url(link) }
|
66
66
|
end
|
67
67
|
|
68
|
+
def remove_artefacts(urls)
|
69
|
+
urls = remove_extra_escape_characters(urls)
|
70
|
+
remove_base64(urls)
|
71
|
+
end
|
72
|
+
|
73
|
+
def remove_extra_escape_characters(urls)
|
74
|
+
urls.map do |url|
|
75
|
+
url.gsub("\">", '')
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
68
79
|
def remove_base64(urls)
|
69
80
|
urls.reject do |url|
|
70
81
|
url.include?(':image/') || url.include?('base64')
|
@@ -75,7 +86,9 @@ module Pulse
|
|
75
86
|
Nokogiri::HTML(raw_html)
|
76
87
|
end
|
77
88
|
|
78
|
-
def add_base_url(str)
|
89
|
+
def add_base_url(str, custom_path_root=nil)
|
90
|
+
return str if custom_path_root
|
91
|
+
|
79
92
|
if !str.include?('https://') && !str.include?(base_url)
|
80
93
|
"https://#{base_url}#{str}"
|
81
94
|
else
|