brand2csv 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +117 -93
- data/.gemtest +0 -0
- data/.gitignore +0 -10
- data/.rspec +0 -1
- data/.travis.yml +0 -14
- data/Gemfile +0 -14
- data/Gemfile.lock +0 -76
- data/History.txt +0 -111
- data/LICENCE.txt +0 -515
- data/Manifest.txt +0 -54
- data/README.md +0 -27
- data/Rakefile +0 -25
- data/bin/brand2csv +0 -100
- data/lib/brand2csv.rb +0 -590
- data/lib/brand2csv/version.rb +0 -3
- data/logs/aspen_08_08_1986.html +0 -598
- data/logs/post.rohdaten.httpfox +0 -1
- data/logs/post.rohdaten.mechanize +0 -1
- data/logs/protocol_swissreg.log +0 -86
- data/logs/result_01.10.2005.jsp +0 -598
- data/logs/sr1.jsp +0 -449
- data/logs/sr3.jsp +0 -598
- data/logs/start.jsp +0 -350
- data/logs/start2.jsp +0 -434
- data/protocol.2013.05.12.textile +0 -56
- data/protocol.2013.05.15.textile +0 -49
- data/protocol.2013.05.21.textile +0 -84
- data/spec/brand2csv_spec.rb +0 -62
- data/spec/csv_spec.rb +0 -27
- data/spec/data/aspectra/detail_00001_P-480296.html +0 -531
- data/spec/data/aspectra/detail_00002_P-482236.html +0 -531
- data/spec/data/aspectra/detail_00003_641074.html +0 -539
- data/spec/data/aspectra/first_results.html +0 -600
- data/spec/data/einfache_suche.html +0 -434
- data/spec/data/erweiterte_suche.html +0 -446
- data/spec/data/main.html +0 -350
- data/spec/data/result_short.html +0 -606
- data/spec/data/resultate_1.html +0 -446
- data/spec/data/resultate_2.html +0 -446
- data/spec/data/urner_wildheu/detail_00001_57862.2013.html +0 -516
- data/spec/data/urner_wildheu/first_results.html +0 -598
- data/spec/data/vereinfachte_1.html +0 -847
- data/spec/data/vereinfachte_detail_33.html +0 -516
- data/spec/detail_spec.rb +0 -28
- data/spec/short_spec.rb +0 -55
- data/spec/simple_search.rb +0 -43
- data/spec/spec_helper.rb +0 -34
- data/spec/support/core_ext/kernel.rb +0 -26
- data/spec/support/server_mock_helper.rb +0 -142
- data/spec/swissreg_spec.rb +0 -44
- data/spec/trademark_numbers_spec.rb +0 -21
- data/spec/utilities_spec.rb +0 -83
- data/spike.rb +0 -491
- data/spike_mechanize_swissreg.rb +0 -312
- data/spike_watir.rb +0 -58
- data/swissreg.rb +0 -75
data/spike.rb
DELETED
@@ -1,491 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#encoding: utf-8
|
3
|
-
|
4
|
-
require 'prettyprint'
|
5
|
-
require 'net/http'
|
6
|
-
require 'cgi'
|
7
|
-
|
8
|
-
# from oddb.org/src/util/http.rb
|
9
|
-
require 'delegate'
|
10
|
-
module ODDB
|
11
|
-
module HttpFile
|
12
|
-
def http_file(server, source, target, session=nil, hdrs = nil)
|
13
|
-
if(body = http_body(server, source, session, hdrs))
|
14
|
-
dir = File.dirname(target)
|
15
|
-
FileUtils.mkdir_p(dir)
|
16
|
-
File.open(target, 'w') { |file|
|
17
|
-
file << body
|
18
|
-
}
|
19
|
-
true
|
20
|
-
end
|
21
|
-
end
|
22
|
-
def http_body(server, source, session=nil, hdrs=nil)
|
23
|
-
session ||= HttpSession.new server
|
24
|
-
hdrs ||= {}
|
25
|
-
resp = session.get(source, hdrs)
|
26
|
-
if resp.is_a? Net::HTTPOK
|
27
|
-
resp.body
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
class HttpSession < SimpleDelegator
|
32
|
-
class ResponseWrapper < SimpleDelegator
|
33
|
-
def initialize(resp)
|
34
|
-
@response = resp
|
35
|
-
super
|
36
|
-
end
|
37
|
-
def body
|
38
|
-
body = @response.body
|
39
|
-
charset = self.charset
|
40
|
-
unless(charset.nil? || charset.downcase == 'utf-8')
|
41
|
-
cd = Iconv.new("UTF-8//IGNORE", charset)
|
42
|
-
begin
|
43
|
-
cd.iconv body
|
44
|
-
rescue
|
45
|
-
body
|
46
|
-
end
|
47
|
-
else
|
48
|
-
body
|
49
|
-
end
|
50
|
-
end
|
51
|
-
def charset
|
52
|
-
if((ct = @response['Content-Type']) \
|
53
|
-
&& (match = /charset=([^;])+/u.match(ct)))
|
54
|
-
arr = match[0].split("=")
|
55
|
-
arr[1].strip.downcase
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
HTTP_CLASS = Net::HTTP
|
60
|
-
RETRIES = 3
|
61
|
-
RETRY_WAIT = 10
|
62
|
-
def initialize(http_server, port=80)
|
63
|
-
@http_server = http_server
|
64
|
-
@http = self.class::HTTP_CLASS.new(@http_server, port)
|
65
|
-
@output = ''
|
66
|
-
super(@http)
|
67
|
-
end
|
68
|
-
def post(path, hash)
|
69
|
-
retries = RETRIES
|
70
|
-
headers = post_headers
|
71
|
-
begin
|
72
|
-
#@http.set_debug_output($stderr)
|
73
|
-
resp = @http.post(path, post_body(hash), headers)
|
74
|
-
case resp
|
75
|
-
when Net::HTTPOK
|
76
|
-
ResponseWrapper.new(resp)
|
77
|
-
when Net::HTTPFound
|
78
|
-
uri = URI.parse(resp['location'])
|
79
|
-
path = (uri.respond_to?(:request_uri)) ? uri.request_uri : uri.to_s
|
80
|
-
warn(sprintf("redirecting to: %s", path))
|
81
|
-
get(path)
|
82
|
-
else
|
83
|
-
raise("could not connect to #{@http_server}: #{resp}")
|
84
|
-
end
|
85
|
-
rescue Errno::ECONNRESET, EOFError
|
86
|
-
if(retries > 0)
|
87
|
-
retries -= 1
|
88
|
-
sleep RETRIES - retries
|
89
|
-
retry
|
90
|
-
else
|
91
|
-
raise
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
def post_headers
|
96
|
-
headers = get_headers
|
97
|
-
headers.push(['Content-Type', 'application/x-www-form-urlencoded'])
|
98
|
-
headers.push(['Referer', @referer.to_s])
|
99
|
-
end
|
100
|
-
def get(*args)
|
101
|
-
retries = RETRIES
|
102
|
-
begin
|
103
|
-
@http.get(*args)
|
104
|
-
rescue Errno::ECONNRESET, Errno::ECONNREFUSED, EOFError
|
105
|
-
if(retries > 0)
|
106
|
-
retries -= 1
|
107
|
-
sleep RETRIES - retries
|
108
|
-
retry
|
109
|
-
else
|
110
|
-
raise
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
def get_headers
|
115
|
-
[
|
116
|
-
['Host', @http_server],
|
117
|
-
['User-Agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20100101 Firefox/16.0'],
|
118
|
-
['Accept', 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1'],
|
119
|
-
['Accept-Encoding', 'gzip, deflate'],
|
120
|
-
['Accept-Language', 'de-ch,en-us;q=0.7,en;q=0.3'],
|
121
|
-
['Accept-Charset', 'UTF-8'],
|
122
|
-
['Keep-Alive', '300'],
|
123
|
-
['Connection', 'keep-alive'],
|
124
|
-
]
|
125
|
-
end
|
126
|
-
def post_body(data)
|
127
|
-
sorted = data.collect { |pair|
|
128
|
-
pair.collect { |item| CGI.escape(item) }.join('=')
|
129
|
-
}
|
130
|
-
sorted.join("&")
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
# from ddob.org/src/util/session.rb
|
135
|
-
module ODDB
|
136
|
-
module Swissreg
|
137
|
-
class Session < HttpSession
|
138
|
-
def initialize
|
139
|
-
host = 'www.swissreg.ch'
|
140
|
-
super(host)
|
141
|
-
@base_uri = "https://#{host}"
|
142
|
-
@http.read_timeout = 120
|
143
|
-
@http.use_ssl = true
|
144
|
-
@http.instance_variable_set("@port", '443')
|
145
|
-
# swissreg does not have sslv3 cert
|
146
|
-
#@http.ssl_version = 'SSLv3'
|
147
|
-
@http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
148
|
-
end
|
149
|
-
def get(url, *args) # this method can not handle redirect
|
150
|
-
res = super
|
151
|
-
@referer = url
|
152
|
-
res
|
153
|
-
end
|
154
|
-
def fetch(uri, limit = 5)
|
155
|
-
raise ArgumentError, 'HTTP redirect too deep' if limit == 0
|
156
|
-
url = URI.parse(URI.encode(uri.strip))
|
157
|
-
option = {
|
158
|
-
:use_ssl => true,
|
159
|
-
# ignore swissreg.ch cert
|
160
|
-
:verify_mode => OpenSSL::SSL::VERIFY_NONE
|
161
|
-
}
|
162
|
-
response = Net::HTTP.start(url.host, option) do |http|
|
163
|
-
http.get url.request_uri
|
164
|
-
end
|
165
|
-
@referer = uri
|
166
|
-
case response
|
167
|
-
when Net::HTTPSuccess
|
168
|
-
response
|
169
|
-
when Net::HTTPRedirection
|
170
|
-
fetch(response['location'], limit - 1)
|
171
|
-
else
|
172
|
-
response.value
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
def detail(url, id, state, param)
|
177
|
-
criteria = [
|
178
|
-
["autoScroll", "0,0"],
|
179
|
-
["id_swissreg:_idcl", "id_swissreg:mainContent:data:0:id_detail"],
|
180
|
-
["id_swissreg:_link_hidden_", ""],
|
181
|
-
["id_swissreg:mainContent:id_sub_options_result:id_ckbSpcChoice", "spc_lbl_title"],
|
182
|
-
["id_swissreg:mainContent:id_sub_options_result:id_ckbSpcChoice", "spc_lbl_pat_type"],
|
183
|
-
["id_swissreg:mainContent:id_sub_options_result:id_ckbSpcChoice", "spc_lbl_basic_pat_no"],
|
184
|
-
["id_swissreg:mainContent:id_sub_options_result:sub_fieldset:id_cbxHitsPerPage", "25"],
|
185
|
-
["id_swissreg:mainContent:scroll_1", ""],
|
186
|
-
["id_swissreg:mainContent:vivian", param],
|
187
|
-
["id_swissreg_SUBMIT", "1"],
|
188
|
-
["javax.faces.ViewState", state],
|
189
|
-
["spcMainId", id]
|
190
|
-
]
|
191
|
-
response = post(url, criteria)
|
192
|
-
update_cookie(response)
|
193
|
-
writer = DetailWriter.new
|
194
|
-
formatter = ODDB::HtmlFormatter.new(writer)
|
195
|
-
parser = ODDB::HtmlParser.new(formatter)
|
196
|
-
parser.feed(response.body)
|
197
|
-
writer.extract_data
|
198
|
-
rescue Timeout::Error
|
199
|
-
{}
|
200
|
-
end
|
201
|
-
def get_headers
|
202
|
-
hdrs = super
|
203
|
-
if(@cookie_id)
|
204
|
-
hdrs.push(['Cookie', @cookie_id])
|
205
|
-
end
|
206
|
-
hdrs
|
207
|
-
end
|
208
|
-
def get_result_list(iksnr)
|
209
|
-
path = '/srclient/'
|
210
|
-
# discard this first response
|
211
|
-
# swissreg.ch could not handle cookie by redirect.
|
212
|
-
# HTTP status code is also strange at redirection.
|
213
|
-
response = fetch(@base_uri + path)
|
214
|
-
# get only view state
|
215
|
-
state = view_state(response)
|
216
|
-
# get cookie
|
217
|
-
path = "/srclient/faces/jsp/start.jsp"
|
218
|
-
response = fetch(@base_uri + path)
|
219
|
-
update_cookie(response)
|
220
|
-
data = [
|
221
|
-
["autoScroll", "0,0"],
|
222
|
-
["id_swissreg:_link_hidden_", ""],
|
223
|
-
["id_swissreg_SUBMIT", "1"],
|
224
|
-
["id_swissreg:_idcl", "id_swissreg_sub_nav_ipiNavigation_item10"],
|
225
|
-
["javax.faces.ViewState", state],
|
226
|
-
]
|
227
|
-
response = post(@base_uri + path, data)
|
228
|
-
# swissreg.ch does not recognize request.
|
229
|
-
# we must send same request again :(
|
230
|
-
sleep(1)
|
231
|
-
response = post(@base_uri + path, data)
|
232
|
-
update_cookie(response)
|
233
|
-
state = view_state(response)
|
234
|
-
data = [
|
235
|
-
["autoScroll", "0,0"],
|
236
|
-
["id_swissreg:_link_hidden_", ""],
|
237
|
-
["id_swissreg:mainContent:id_txf_basic_pat_no",""],
|
238
|
-
["id_swissreg:mainContent:id_txf_spc_no",""],
|
239
|
-
["id_swissreg:mainContent:id_txf_title",""],
|
240
|
-
["id_swissreg_SUBMIT", "1"],
|
241
|
-
["id_swissreg:_idcl", "id_swissreg_sub_nav_ipiNavigation_item10_item13"],
|
242
|
-
["javax.faces.ViewState", state],
|
243
|
-
]
|
244
|
-
path = "/srclient/faces/jsp/spc/sr1.jsp"
|
245
|
-
response = post(@base_uri + path, data)
|
246
|
-
update_cookie(response)
|
247
|
-
criteria = [
|
248
|
-
["autoScroll", "0,0"],
|
249
|
-
["id_swissreg:_idcl", ""],
|
250
|
-
["id_swissreg:_link_hidden_", ""],
|
251
|
-
["id_swissreg:mainContent:id_cbxHitsPerPage", "25"],
|
252
|
-
["id_swissreg:mainContent:id_cbxSpcAppCountry", "_ALL"],
|
253
|
-
["id_swissreg:mainContent:id_cbxSpcAppSearchMode", "_ALL"],
|
254
|
-
["id_swissreg:mainContent:id_cbxSpcAuthority", "_ALL"],
|
255
|
-
["id_swissreg:mainContent:id_cbxSpcFormatChoice", "1"],
|
256
|
-
["id_swissreg:mainContent:id_cbxSpcLanguage", "_ALL"],
|
257
|
-
["id_swissreg:mainContent:id_ckbSpcChoice", "spc_lbl_title"],
|
258
|
-
["id_swissreg:mainContent:id_ckbSpcChoice", "spc_lbl_pat_type"],
|
259
|
-
["id_swissreg:mainContent:id_ckbSpcChoice", "spc_lbl_basic_pat_no"],
|
260
|
-
["id_swissreg:mainContent:id_ckbSpcPubReason", "1"],
|
261
|
-
["id_swissreg:mainContent:id_ckbSpcPubReason", "2"],
|
262
|
-
["id_swissreg:mainContent:id_ckbSpcPubReason", "7"],
|
263
|
-
["id_swissreg:mainContent:id_ckbSpcPubReason", "8"],
|
264
|
-
["id_swissreg:mainContent:id_ckbSpcPubReason", "3"],
|
265
|
-
["id_swissreg:mainContent:id_ckbSpcPubReason", "4"],
|
266
|
-
["id_swissreg:mainContent:id_ckbSpcPubReason", "5"],
|
267
|
-
["id_swissreg:mainContent:id_ckbSpcPubReason", "6"],
|
268
|
-
["id_swissreg:mainContent:id_ckbSpcViewState", "act"],
|
269
|
-
["id_swissreg:mainContent:id_ckbSpcViewState", "pen"],
|
270
|
-
["id_swissreg:mainContent:id_ckbSpcViewState", "del"],
|
271
|
-
["id_swissreg:mainContent:id_txf_agent", ""],
|
272
|
-
["id_swissreg:mainContent:id_txf_app_city", ""],
|
273
|
-
["id_swissreg:mainContent:id_txf_app_date", ""],
|
274
|
-
["id_swissreg:mainContent:id_txf_applicant", ""],
|
275
|
-
["id_swissreg:mainContent:id_txf_auth_date", ""],
|
276
|
-
["id_swissreg:mainContent:id_txf_auth_no", iksnr],
|
277
|
-
["id_swissreg:mainContent:id_txf_basic_pat_no", ""],
|
278
|
-
["id_swissreg:mainContent:id_txf_basic_pat_start_date", ""],
|
279
|
-
["id_swissreg:mainContent:id_txf_del_date", ""],
|
280
|
-
["id_swissreg:mainContent:id_txf_expiry_date", ""],
|
281
|
-
["id_swissreg:mainContent:id_txf_grant_date", ""],
|
282
|
-
["id_swissreg:mainContent:id_txf_pub_app_date", ""],
|
283
|
-
["id_swissreg:mainContent:id_txf_pub_date", ""],
|
284
|
-
["id_swissreg:mainContent:id_txf_spc_no", ""],
|
285
|
-
["id_swissreg:mainContent:id_txf_title", ""],
|
286
|
-
["id_swissreg:mainContent:sub_fieldset:id_submit", "suchen"],
|
287
|
-
["id_swissreg_SUBMIT", "1"],
|
288
|
-
["javax.faces.ViewState", view_state(response)]
|
289
|
-
]
|
290
|
-
path = "/srclient/faces/jsp/spc/sr3.jsp"
|
291
|
-
response = post(@base_uri + path, criteria)
|
292
|
-
update_cookie(response)
|
293
|
-
extract_result_links(response)
|
294
|
-
rescue Timeout::Error
|
295
|
-
[]
|
296
|
-
end
|
297
|
-
def post(url, *args)
|
298
|
-
res = super
|
299
|
-
@referer = url
|
300
|
-
res
|
301
|
-
end
|
302
|
-
def update_cookie(response)
|
303
|
-
if(hdr = response['set-cookie'])
|
304
|
-
@cookie_id = hdr[/^[^;]+/u]
|
305
|
-
end
|
306
|
-
end
|
307
|
-
def view_state(response)
|
308
|
-
if match = /javax.faces.ViewState.*?value="([^"]+)"/u.match(response.body.force_encoding('utf-8'))
|
309
|
-
match[1]
|
310
|
-
else
|
311
|
-
""
|
312
|
-
end
|
313
|
-
end
|
314
|
-
|
315
|
-
# Neu von Niklaus
|
316
|
-
def writeResponse(filename, body)
|
317
|
-
ausgabe = File.open(filename, 'w+')
|
318
|
-
ausgabe.puts body
|
319
|
-
ausgabe.close
|
320
|
-
end
|
321
|
-
|
322
|
-
def getSimpleMarkenSuche(timespan = "1.11.2011-5.11.2011", marke = "")
|
323
|
-
puts("getSimpleMarkenSuche #{timespan}")
|
324
|
-
path = '/srclient/'
|
325
|
-
# discard this first response
|
326
|
-
# swissreg.ch could not handle cookie by redirect.
|
327
|
-
# HTTP status code is also strange at redirection.
|
328
|
-
response = fetch(@base_uri + path)
|
329
|
-
# get only view state
|
330
|
-
state = view_state(response)
|
331
|
-
# get cookie
|
332
|
-
path = "/srclient/faces/jsp/start.jsp"
|
333
|
-
response = fetch(@base_uri + path)
|
334
|
-
update_cookie(response)
|
335
|
-
data = [
|
336
|
-
["autoScroll", "0,0"],
|
337
|
-
["id_swissreg:_link_hidden_", ""],
|
338
|
-
["id_swissreg_SUBMIT", "1"],
|
339
|
-
["id_swissreg:_idcl", "id_swissreg_sub_nav_ipiNavigation_item0"],
|
340
|
-
["javax.faces.ViewState", state],
|
341
|
-
]
|
342
|
-
|
343
|
-
response = post(@base_uri + path, data)
|
344
|
-
# swissreg.ch does not recognize request.
|
345
|
-
# we must send same request again :(
|
346
|
-
sleep(1)
|
347
|
-
response = post(@base_uri + path, data)
|
348
|
-
writeResponse('einfache_suche.html', response.body)
|
349
|
-
update_cookie(response)
|
350
|
-
state = view_state(response)
|
351
|
-
data = [
|
352
|
-
["autoScroll", "0,0"],
|
353
|
-
["id_swissreg:_link_hidden_", ""],
|
354
|
-
["id_swissreg_SUBMIT", "1"],
|
355
|
-
["id_swissreg:_idcl", "id_swissreg_sub_nav_ipiNavigation_item0_item3"],
|
356
|
-
["javax.faces.ViewState", state],
|
357
|
-
]
|
358
|
-
|
359
|
-
# sr1 ist die einfache suche, sr3 die erweiterte Suche
|
360
|
-
path = '/srclient/faces/jsp/trademark/sr3.jsp'
|
361
|
-
response = post(@base_uri + path, data)
|
362
|
-
body = response.body
|
363
|
-
writeResponse('erweiterte_suche.html', response.body)
|
364
|
-
update_cookie(response)
|
365
|
-
state = view_state(response)
|
366
|
-
# Grösste angezeigte Anzahl bis jetzt 441
|
367
|
-
# Bei grosser Anzahl kommt (ab 981)
|
368
|
-
# Gemäss https://www.swissreg.ch/help/de/sr2000.shtm
|
369
|
-
# Bitte beachten Sie, dass insgesamt maximal 500 Treffer angezeigt werden. Sollte Ihre Suche mehr als 500 Treffer ergeben, wird eine vereinfachte Trefferliste angezeigt. Sollte Ihre Suche mehr als 10’000 Treffer ergeben, dann werden willkürlich 10’000 Treffer ausgewählt und angezeigt.
|
370
|
-
|
371
|
-
x = %(
|
372
|
-
Es wurden 35,539 Treffer gefunden. Davon werden 10,000 zufällig ausgewählte Schutztitel angezeigt.
|
373
|
-
|
374
|
-
Aufgrund der grossen Datenmenge wird Ihnen eine vereinfachte Trefferliste angezeigt. Alternativ können Sie die Suche weiter einschränken damit Ihnen die vollständige Trefferliste zur Verfügung steht.
|
375
|
-
# Link nach /srclient/faces/jsp/trademark/show_simple_view.jsp.
|
376
|
-
)
|
377
|
-
# ngng 0 formular">Markenart</td><td class="w300"><select id="id_swissreg:mainContent:id_cbxTMTypeGrp
|
378
|
-
criteria = [
|
379
|
-
["autoScroll", "0,0"],
|
380
|
-
["id_swissreg:_link_hidden_", ""],
|
381
|
-
# "id_swissreg:mainContent:id_cbxFormatChoice" 2 = Publikationsansicht 1 = Registeransicht
|
382
|
-
["id_swissreg:mainContent:id_cbxFormatChoice", "1"],
|
383
|
-
["id_swissreg:mainContent:id_ckbTMState", "1"], # "Hängige Gesuche 1
|
384
|
-
# ["id_swissreg:mainContent:id_ckbTMState", "2"], # "Gelöschte Gesuche 2
|
385
|
-
["id_swissreg:mainContent:id_ckbTMState", "3"], # aktive Marken 3
|
386
|
-
# ["id_swissreg:mainContent:id_ckbTMState", "4"], # gelöschte Marken 4
|
387
|
-
["id_swissreg:mainContent:id_cbxCountry", "CH"], # Auswahl Länder _ALL
|
388
|
-
["id_swissreg:mainContent:id_txf_tm_no", ""], # Marken Nr
|
389
|
-
["id_swissreg:mainContent:id_txf_app_no", ""], # Gesuch Nr.
|
390
|
-
["id_swissreg:mainContent:id_txf_tm_text", "#{marke}"], # Wortlaut der Marke
|
391
|
-
["id_swissreg:mainContent:id_txf_applicant", ""], # Inhaber/in
|
392
|
-
["id_swissreg:mainContent:id_txf_agent", ""], # Vertreter/in
|
393
|
-
["id_swissreg:mainContent:id_txf_licensee", ""], # Lizenznehmer
|
394
|
-
["id_swissreg:mainContent:id_txf_nizza_class", ""], # Nizza Klassifikation Nr.
|
395
|
-
["id_swissreg:mainContent:id_txf_appDate", "#{timespan}"], # Hinterlegungsdatum
|
396
|
-
["id_swissreg:mainContent:id_txf_expiryDate", ""], # Ablauf Schutzfrist
|
397
|
-
# Markenart: Individualmarke 1 Kollektivmarke 2 Garantiemarke 3
|
398
|
-
["id_swissreg:mainContent:id_cbxTMTypeGrp", "_ALL"], # Markenart
|
399
|
-
["id_swissreg:mainContent:id_cbxTMForm", "_ALL"], # Markentyp
|
400
|
-
["id_swissreg:mainContent:id_cbxTMColorClaim", "_ALL"], # Farbanspruch
|
401
|
-
["id_swissreg:mainContent:id_txf_pub_date", ""], # Publikationsdatum
|
402
|
-
# name="id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_applicant"], # /> Inhaber/in</label></td>
|
403
|
-
|
404
|
-
# info zu Publikationsgrund id_swissreg:mainContent:id_ckbTMPubReason
|
405
|
-
["id_swissreg:mainContent:id_ckbTMPubReason", "1"], #Neueintragungen
|
406
|
-
["id_swissreg:mainContent:id_ckbTMPubReason", "2"], #Berichtigungen
|
407
|
-
["id_swissreg:mainContent:id_ckbTMPubReason", "3"], #Verlängerungen
|
408
|
-
["id_swissreg:mainContent:id_ckbTMPubReason", "4"], #Löschungen
|
409
|
-
["id_swissreg:mainContent:id_ckbTMPubReason", "5"], #Inhaberänderungen
|
410
|
-
["id_swissreg:mainContent:id_ckbTMPubReason", "6"], #Vertreteränderungen
|
411
|
-
["id_swissreg:mainContent:id_ckbTMPubReason", "7"], #Lizenzänderungen
|
412
|
-
["id_swissreg:mainContent:id_ckbTMPubReason", "8"], #Weitere Registeränderungen
|
413
|
-
["id_swissreg:mainContent:id_ckbTMEmptyHits", "0"], # Leere Trefferliste anzeigen
|
414
|
-
|
415
|
-
# Angezeigte Spalten "id_swissreg:mainContent:id_ckbTMChoice"
|
416
|
-
["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_tm_text"], # Marke
|
417
|
-
# ["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_state"], # Status
|
418
|
-
# ["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_nizza_class"], # Nizza Klassifikation Nr.
|
419
|
-
# ["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_no"], # disabled="disabled"], # Nummer
|
420
|
-
["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_applicant"], # Inhaber/in
|
421
|
-
["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_country"], # Land (Inhaber/in)
|
422
|
-
# ["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_agent"], # Vertreter/in
|
423
|
-
# ["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_licensee"], # Lizenznehmer/in
|
424
|
-
["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_app_date"], # Hinterlegungsdatum
|
425
|
-
# ["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_expiry_date"], # Ablauf Schutzfrist
|
426
|
-
# ["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_type_grp"], # Markenart
|
427
|
-
# ["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_form"], # Markentyp
|
428
|
-
# ["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_color_claim"], # Farbanspruch
|
429
|
-
|
430
|
-
["id_swissreg:mainContent:id_cbxHitsPerPage", "100"], # Treffer pro Seite
|
431
|
-
["id_swissreg:mainContent:id_ckbTMChoice", "tm_lbl_applicant"],
|
432
|
-
["id_swissreg:mainContent:sub_fieldset:id_submit", "suchen"],
|
433
|
-
# ["id_swissreg:mainContent:sub_fieldset:id_reset", "0"],
|
434
|
-
["id_swissreg_SUBMIT", "1"],
|
435
|
-
["javax.faces.ViewState", state],
|
436
|
-
]
|
437
|
-
|
438
|
-
# Somehow the criteria does not get posted correctly
|
439
|
-
response = post(@base_uri + path, criteria)
|
440
|
-
update_cookie(response)
|
441
|
-
# Hier kommt jedoch die Seite mit Suchkriterien
|
442
|
-
# https://www.swissreg.ch/help/de/trademark/sr3000.shtm#cbxCountry
|
443
|
-
body = response.body
|
444
|
-
unless body.index('Schutztitel') or body.index('Suchkriterien')
|
445
|
-
hilfeName = 'hilfeseite.html'
|
446
|
-
writeResponse(hilfeName, response.body)
|
447
|
-
puts "Tut mir leid! and nur die Hilfeseite. Schrieb #{hilfeName}"
|
448
|
-
exit
|
449
|
-
end
|
450
|
-
|
451
|
-
# Weitere gesehene Fehler
|
452
|
-
bekannteFehler =
|
453
|
-
['Das Datum ist ung', # ültig'
|
454
|
-
'Es wurden keine Daten gefunden.',
|
455
|
-
'Die Suchkriterien sind teilweise unzul', # ässig',
|
456
|
-
'Geben Sie mindestens ein Suchkriterium ein',
|
457
|
-
'Die Suche wurde abgebrochen, da die maximale Suchzeit von 60 Sekunden',
|
458
|
-
]
|
459
|
-
# » Die Suche wurde abgebrochen, da die maximale Suchzeit von 60 Sekunden überschritten wurde. Bitte formulieren Sie eine präzisere Suche.
|
460
|
-
bekannteFehler.each {
|
461
|
-
|errMsg|
|
462
|
-
if body.to_s.index(errMsg)
|
463
|
-
infoName = 'infoseite.html'
|
464
|
-
writeResponse(infoName, response.body)
|
465
|
-
writeResponse('infoseite.html', response.body)
|
466
|
-
puts "Tut mir leid. Fand Fehlermeldung <#{errMsg}<. Erstellte nur eine Infoseite #{infoName}."
|
467
|
-
exit 2
|
468
|
-
end
|
469
|
-
}
|
470
|
-
|
471
|
-
name = 'resultat_1.html'
|
472
|
-
x = /([\d,]*)\D* Treffer gefunden/.match(body)
|
473
|
-
if x
|
474
|
-
puts "Fand #{x[1]} Resultate für #{timespan} "
|
475
|
-
end
|
476
|
-
x = /Treffer (\d*)-(\d*) von (\d*)/.match(body)
|
477
|
-
if x
|
478
|
-
puts "Fand #{x[0]} für #{timespan} "
|
479
|
-
end
|
480
|
-
|
481
|
-
puts "Resultate für #{timespan} scheinen gültig zu sein. Schreibe Datei #{name}"
|
482
|
-
writeResponse(name, response.body)
|
483
|
-
end
|
484
|
-
|
485
|
-
end
|
486
|
-
end
|
487
|
-
end
|
488
|
-
|
489
|
-
mySession = ODDB::Swissreg::Session.new
|
490
|
-
mySession.getSimpleMarkenSuche( "1.10.2011-5.10.2011", "asp*")
|
491
|
-
|