brand2csv 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +4 -0
- data/lib/brand2csv.rb +20 -6
- data/lib/brand2csv/version.rb +1 -1
- metadata +4 -4
data/History.txt
CHANGED
data/lib/brand2csv.rb
CHANGED
@@ -10,6 +10,7 @@ require 'logger'
|
|
10
10
|
|
11
11
|
module Brand2csv
|
12
12
|
|
13
|
+
|
13
14
|
class Marke < Struct.new(:name, :markennummer, :inhaber, :land, :hinterlegungsdatum, :zeile_1, :zeile_2, :zeile_3, :zeile_4, :zeile_5, :plz, :ort)
|
14
15
|
end
|
15
16
|
|
@@ -420,11 +421,18 @@ module Brand2csv
|
|
420
421
|
# There we find info like "Seite 1 von 26 - Treffer 1-250 von 6'349" and upto 250 links to details
|
421
422
|
def initialize(doc)
|
422
423
|
@inputData = []
|
424
|
+
@pageNr = @nrSubPages = @firstHit = @nrHits = 0
|
423
425
|
m = HitRegexpDE.match(doc.text)
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
426
|
+
if m
|
427
|
+
begin
|
428
|
+
c = m.to_a.map{|n| n.gsub(/'/, "").to_i }
|
429
|
+
@pageNr = c[1]
|
430
|
+
@nrSubPages = c[2]
|
431
|
+
@firstHit = c[3]
|
432
|
+
@nrHits = c[5]
|
433
|
+
rescue NoMethodError
|
434
|
+
end
|
435
|
+
end
|
428
436
|
@trademark_search_id = Swissreg::inputValue(Swissreg::getInputValuesFromPage(doc), Vivian)
|
429
437
|
@links2details = []
|
430
438
|
doc.search('input').each{ |input|
|
@@ -478,13 +486,19 @@ module Brand2csv
|
|
478
486
|
if filename && File.exists?(filename)
|
479
487
|
doc = Nokogiri::Slop(File.open(filename))
|
480
488
|
else
|
481
|
-
|
489
|
+
form = @agent.page.form
|
490
|
+
btn = form.buttons.last
|
491
|
+
if btn && btn.name == "id_swissreg:mainContent:id_show_simple_view_hitlist"
|
492
|
+
res = @agent.submit(form, btn)
|
493
|
+
body = res.body
|
494
|
+
else
|
495
|
+
body = @agent.page.body
|
496
|
+
end
|
482
497
|
body.force_encoding('utf-8') unless /^1\.8/.match(RUBY_VERSION)
|
483
498
|
doc = Nokogiri::Slop(body)
|
484
499
|
filename = "#{LogDir}/vereinfachte_#{pageNr}.html"
|
485
500
|
writeResponse(filename)
|
486
501
|
end
|
487
|
-
|
488
502
|
einfach = Swissreg::Vereinfachte.new(doc)
|
489
503
|
puts "#{Time.now.strftime("%H:%M:%S")} status: getAllHits for #{pageNr} of #{einfach.nrSubPages} pages" if $VERBOSE
|
490
504
|
subPage2Fetch = pageNr + 1
|
data/lib/brand2csv/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brand2csv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 7
|
10
|
+
version: 0.2.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Niklaus Giger, Zeno R.R. Davatz
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-08-
|
18
|
+
date: 2013-08-27 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: mechanize
|