brand2csv 0.1.7 → 0.1.8
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/README.md +18 -3
- data/lib/brand2csv.rb +9 -4
- data/lib/brand2csv/version.rb +1 -1
- metadata +2 -2
data/History.txt
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,21 @@
|
|
1
1
|
# brand2csv
|
2
2
|
|
3
|
-
brand2csv
|
4
|
-
=========
|
3
|
+
brand2csv using swissreg.ch to get addresses.
|
5
4
|
|
6
|
-
|
5
|
+
## Usage
|
6
|
+
brand2csv 01.01.2013 "b*"
|
7
|
+
|
8
|
+
## Help
|
9
|
+
```
|
10
|
+
~> brand2csv --help
|
11
|
+
/usr/local/bin/brand2csv ver.0.1.7
|
12
|
+
Usage:
|
13
|
+
brand2csv timespan
|
14
|
+
Find all brands registered in switzerland during the given timespan.
|
15
|
+
The following examples valid timespan periods:
|
16
|
+
1.10.2005
|
17
|
+
1.10.2005-31.10.2005
|
18
|
+
1.10.2005, 5.10.2005-31.10.2005
|
19
|
+
The results are stored in the file ausgabe.csv.
|
20
|
+
The trademark name is either a real brand name or a link to an image.
|
21
|
+
```
|
data/lib/brand2csv.rb
CHANGED
@@ -546,9 +546,9 @@ module Brand2csv
|
|
546
546
|
@agent.page.forms.first.submit
|
547
547
|
break
|
548
548
|
rescue
|
549
|
-
puts "Rescue in submit. nrTries is #{nrTries}"
|
549
|
+
puts "Rescue in submit. nrTries is #{nrTries}. Retry after a few seconds"
|
550
550
|
nrTries += 1
|
551
|
-
sleep
|
551
|
+
sleep 10
|
552
552
|
exit 1 if nrTries > 3
|
553
553
|
end
|
554
554
|
end
|
@@ -562,6 +562,7 @@ module Brand2csv
|
|
562
562
|
end
|
563
563
|
@results << Swissreg::getMarkenInfoFromDetail(Nokogiri::Slop(@agent.page.body))
|
564
564
|
@agent.back
|
565
|
+
sleep 1
|
565
566
|
}
|
566
567
|
filename = "#{LogDir}/vereinfachte_#{pageNr}_back.html"
|
567
568
|
writeResponse(filename)
|
@@ -600,8 +601,12 @@ module Brand2csv
|
|
600
601
|
|
601
602
|
def Brand2csv::run(timespan, marke = 'a*')
|
602
603
|
session = Swissreg.new(timespan, marke)
|
603
|
-
|
604
|
-
|
604
|
+
begin
|
605
|
+
session.parse_swissreg
|
606
|
+
session.fetchresult
|
607
|
+
rescue Interrupt, Net::HTTP::Persistent::Error
|
608
|
+
puts "Unterbrochen. Vesuche #{session.results.size} Resultate zu speichern"
|
609
|
+
end
|
605
610
|
Swissreg::emitCsv(session.results, "#{timespan}.csv")
|
606
611
|
end
|
607
612
|
|
data/lib/brand2csv/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brand2csv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-06-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mechanize
|