zeitungen 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/lib/zeitungen/downloader.rb +9 -2
- data/lib/zeitungen/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a846b2505bc2a7bf100f9b1f4a3c8641759ae3c
|
4
|
+
data.tar.gz: db99b50955e6b51b613381e4d01125ce24c5e6a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63e38445c086d9db9852c7c1303ac76074586385a64b2b9d6c5db497751b1312712f6521e01b4dbaae8335cfa7d46c4a2da6f8a6b9cc5d8c0aea13876fd65fc6
|
7
|
+
data.tar.gz: f33fe04a75b4f3465a2cb1005857a799100c91ce6def1dcdae5f9757a1ab468be6897ad1fa6908ecdec1d002c9076f793bc7bd870f45a2f0ccfe7e352d4c7642
|
data/.gitignore
CHANGED
data/lib/zeitungen/downloader.rb
CHANGED
@@ -14,6 +14,7 @@ module Zeitungen
|
|
14
14
|
|
15
15
|
page = IndexPage.new(@url, @passwords)
|
16
16
|
zeitungen_links = page.links(date)
|
17
|
+
# puts zeitungen_links.inspect
|
17
18
|
queue = enqueue(zeitungen_links)
|
18
19
|
|
19
20
|
if queue.size==0
|
@@ -35,7 +36,13 @@ module Zeitungen
|
|
35
36
|
queue = Queue.new
|
36
37
|
@zeitungen.each do |z|
|
37
38
|
if link = zeitungen_links.find{|l| z.regexp.match l.text } # se c'è un link per il zeitungen corrente
|
38
|
-
|
39
|
+
uri = link.uri
|
40
|
+
if uri.host=="t.umblr.com"
|
41
|
+
h = Hash[uri.query.split("&").map{|e| e.split("=")}]
|
42
|
+
z.uri = URI(URI.unescape(h["z"])+"\?directDownload\=true")
|
43
|
+
else
|
44
|
+
z.uri = uri+"\?directDownload\=true" # zeitungen.uri+"\?directDownload\=true"
|
45
|
+
end
|
39
46
|
filename = filename_w_date(z.final_name) # "Corriere della Sera - 2015-12-23.pdf"
|
40
47
|
|
41
48
|
queue << z if !(@client.exist_in_public_dest?(filename) || @client.exist_in_private_dest?(filename))
|
@@ -53,7 +60,7 @@ module Zeitungen
|
|
53
60
|
file = Tempfile.new('zeitungen')
|
54
61
|
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme=='https') do |http|
|
55
62
|
request = Net::HTTP::Get.new(uri)
|
56
|
-
puts "downloading #{z.final_name}..."
|
63
|
+
puts "downloading #{z.final_name} (#{z.uri})..."
|
57
64
|
response = http.request request
|
58
65
|
file.write(response.body)
|
59
66
|
end
|
data/lib/zeitungen/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zeitungen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Iwan Buetti
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|