brand2csv 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/lib/brand2csv.rb +16 -3
- data/lib/brand2csv/version.rb +1 -1
- metadata +1 -1
data/History.txt
CHANGED
data/lib/brand2csv.rb
CHANGED
@@ -440,7 +440,9 @@ module Brand2csv
|
|
440
440
|
}
|
441
441
|
ausgabe.puts s.chop
|
442
442
|
}
|
443
|
+
ausgabe.close
|
443
444
|
else
|
445
|
+
|
444
446
|
CSV.open(filename, 'w', :headers=>results[0].members,
|
445
447
|
:write_headers => true,
|
446
448
|
:col_sep => ';'
|
@@ -517,7 +519,7 @@ module Brand2csv
|
|
517
519
|
doc = Nokogiri::Slop(File.open(filename))
|
518
520
|
else
|
519
521
|
body = @agent.page.body
|
520
|
-
body.force_encoding('utf-8')
|
522
|
+
body.force_encoding('utf-8') unless /^1\.8/.match(RUBY_VERSION)
|
521
523
|
doc = Nokogiri::Slop(body)
|
522
524
|
filename = "#{LogDir}/vereinfachte_#{pageNr}.html"
|
523
525
|
writeResponse(filename)
|
@@ -538,7 +540,18 @@ module Brand2csv
|
|
538
540
|
nextId = einfach.firstHit.to_i - 1 + position.to_i
|
539
541
|
data3 = einfach.getPostDataForDetail(nextId, id)
|
540
542
|
Swissreg::setAllInputValue(@agent.page.forms.first, data3)
|
541
|
-
|
543
|
+
nrTries = 1
|
544
|
+
while true
|
545
|
+
begin
|
546
|
+
@agent.page.forms.first.submit
|
547
|
+
break
|
548
|
+
rescue
|
549
|
+
puts "Rescue in submit. nrTries is #{nrTries}"
|
550
|
+
nrTries += 1
|
551
|
+
sleep 1
|
552
|
+
exit 1 if nrTries > 3
|
553
|
+
end
|
554
|
+
end
|
542
555
|
filename = "#{LogDir}/vereinfachte_detail_#{einfach.firstHit + position}.html"
|
543
556
|
writeResponse(filename)
|
544
557
|
matchResult = @agent.page.search('h1').text
|
@@ -567,7 +580,7 @@ module Brand2csv
|
|
567
580
|
doc = Nokogiri::Slop(File.open(filename))
|
568
581
|
else
|
569
582
|
body = @agent.page.body
|
570
|
-
body.force_encoding('utf-8')
|
583
|
+
body.force_encoding('utf-8') unless /^1\.8/.match(RUBY_VERSION)
|
571
584
|
doc = Nokogiri::Slop(body)
|
572
585
|
writeResponse(filename)
|
573
586
|
end
|
data/lib/brand2csv/version.rb
CHANGED