transportscrapper 1.0.1 → 1.0.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/TransportScrapper.rb +10 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3832beacbf6dc88c3b9545880c75d98a6117f0922267382c5e5e24d93653ffdf
4
- data.tar.gz: 54f0d150c5bf856e49fc59d0d58c78d166e863011624afadaaa6eff46396c912
3
+ metadata.gz: f034ac107c9fcff40a38e19f833786f2df8e8632ea39bc3f37a0bfab0f2f17c7
4
+ data.tar.gz: ea74b2b1477c03d3d284865c72ffeebffc4d906c20c5d41bb9bcef1315253ef0
5
5
  SHA512:
6
- metadata.gz: fea2cc73d03bc51931eb090d10f1ea42756a939fcf0792ce797266e3d5e097d97ad99dbc196044f4da25a36d98346d0bb15c31e0c285048fff36c49f35fd28b0
7
- data.tar.gz: 4c0292fca37c0c82f292cae3cb627f972156692b7559a313586bd27941315b1ffb4271d71bbf4ff25bee1fdd5aca599ab60ea9dc80ddf1cb75640796e7dddaf8
6
+ metadata.gz: 1b070a9dc41154a3494f833ca0bd0fcee2fb1777c5d0c8843b9c96fa87670987a9530abb68cff8edadeae01e577b88ba232f38894fa4546d973b93f7fd7db53c
7
+ data.tar.gz: d87c000c716f9df9dc6a37194f00476d28ce376a14d4c1c77c7c7a082ec2f49ebd276e0f2151d6e1f71943ff7195c04194f49587730f084559f2670ea1d65199
@@ -6,7 +6,7 @@ class TransportScrapper
6
6
  @outwardArr = []
7
7
  @returnArr = []
8
8
 
9
- def self.scrapewithtime(value)
9
+ def self.scrapewithtime(value, time)
10
10
  @browser.goto value
11
11
  doc = Nokogiri::HTML.parse(@browser.html)
12
12
  #taking all the hotels list in HTML
@@ -48,11 +48,12 @@ onwardtransport_snip_array.each do |transport_elemets|
48
48
  output.store("arrival", arrival)
49
49
  output.store("price", price)
50
50
  output.store("route",route)
51
+ output.store("time",time)
51
52
  output.store("id", "#{depart}_#{arrival}_#{route}")
52
53
 
53
54
 
54
55
  #pushing to array
55
- if(!@outwardArr.include?(output))
56
+ if(!@returnArr.any? {|hashelement| hashelement[:id] == output["id"]})
56
57
  @outwardArr.push(output)
57
58
  end
58
59
  end
@@ -97,10 +98,12 @@ returntransport_snip_array.each do |transport_elemets|
97
98
  output.store("arrival", arrival)
98
99
  output.store("price", price)
99
100
  output.store("route",route)
101
+ output.store("time",time)
100
102
  output.store("id", "#{depart}_#{arrival}_#{route}")
101
103
 
102
104
  #pushing to array
103
- if(!@returnArr.include?(output))
105
+
106
+ if(!@returnArr.any? {|hashelement| hashelement[:id] == output["id"]})
104
107
  @returnArr.push(output)
105
108
  end
106
109
  end
@@ -130,7 +133,7 @@ for time in timeArr do
130
133
  joinstr ="&returntime=#{time}&departtime=#{time}"
131
134
  temp = value+joinstr
132
135
 
133
- self.scrapewithtime(temp)
136
+ self.scrapewithtime(temp, time)
134
137
  end
135
138
 
136
139
  #returning array
@@ -142,5 +145,8 @@ return result
142
145
 
143
146
  end
144
147
 
148
+ val = TransportScrapper.scrape("https://national.buseireann.ie/?originStop=13500&destinationstop=55504&ticketType=2&departdate=01-dec-2019&returndate=02-dec-2019&adult=1&child=0&student=0&family=0")
149
+
150
+ puts val
145
151
  end
146
152
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transportscrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niranjan Karunanithi