rakuten_securities_scraper 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16a2376da1337dfc32d2b319e40110fe7a70448d6c86f77e096b11c7673349e7
4
- data.tar.gz: 409ee19906a3ea99dff6d41e67460443821a2da9d6e9cb38248ff75c95823b9c
3
+ metadata.gz: af1bd8cc0abba9b3116e6636a63ca1c2e8444cef3dcd235302bdf42eb7dd6836
4
+ data.tar.gz: a9a10da8d97ce4988b601bc9fcf75329e6782a865636478f679fe0751d582060
5
5
  SHA512:
6
- metadata.gz: 9b2dead8449bfe20ed0b794ddc4ef8fe715ac68894b4f4939a59850b1b7d112ba903fca01245093ce57463a8b3f2355b82ad1d64475193caabd3e38f9086e9d6
7
- data.tar.gz: 573093ff0c9c25471f1c15f5a09be55944ce2edbb22f3ccbe9a33783cab6555d9d4913c0c4c7ff0efd71236fb3777e926475c46d36dfadcf0e3579e8f8c8cb2c
6
+ metadata.gz: 74b63aebc080956c50f098e7bf699ceb19f8b0699b701f1e20aeaafd3361ef7c0ef266ae6fd5442944980ffa83fd007400c9383af2c61e9dea27b0fd964f1c75
7
+ data.tar.gz: '0961d672f7f487d62464a3a2a4ce16adb04bcd6ddc7f7e53b640b24a7dcefbb49795196db45f814e7593c14e9ef2a5caf144430e8b422c44f58b779e2f449813'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rakuten_securities_scraper (0.1.4)
4
+ rakuten_securities_scraper (0.1.5)
5
5
  selenium-webdriver (~> 3.142.7)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -63,6 +63,11 @@ Or install it yourself as:
63
63
  ## Get Today's Executed Order
64
64
  puts data.todays_order
65
65
 
66
+ ## Add favorite list
67
+ page_num : Integer 1..10
68
+ codes : Array ["4755", "4875",,,]
69
+ puts data.favorite page_num, codes
70
+
66
71
  ```
67
72
 
68
73
  ## Development
@@ -42,7 +42,32 @@ module RakutenSecuritiesScraper
42
42
  next if result == "already exist"
43
43
  end
44
44
  driver.find_element(id: "prc_save_button1").click
45
- { status: "success"}
45
+ { status: "success" }
46
+ end
47
+
48
+ def delete_favorite page_num
49
+ driver = login
50
+ sleep 2
51
+ driver.action.move_to(driver.find_element(id: "gmenu_domestic_stock")).perform
52
+ sleep 2
53
+ driver.find_element(id: "gmenu_domestic_stock").click
54
+ sleep 2
55
+ driver.find_element(link_text: "お気に入り銘柄").click
56
+ sleep 2
57
+ driver.find_element(link_text: page_num).click
58
+ sleep 2
59
+ driver.find_element(name: "editAnchor").click
60
+ sleep 2
61
+ table = driver.find_element(class_name: "tbl-data-01")
62
+ rows = table.find_elements(xpath: "//tr")
63
+ last_row = rows.size - 2
64
+ rows[2..last_row].each do |row|
65
+ driver.find_element(id: "line_delete_button_1").click
66
+ driver.switch_to.alert.accept
67
+ sleep 1
68
+ end
69
+ driver.find_element(id: "prc_save_button1").click
70
+ { status: "success" }
46
71
  end
47
72
 
48
73
  def click_favorite driver, code
@@ -54,7 +79,7 @@ module RakutenSecuritiesScraper
54
79
  rows = driver.find_elements(xpath: "//tr")
55
80
  value = ""
56
81
  num = 0
57
- rows[3..rows.size-1].each_with_index do |f, i|
82
+ rows[3..rows.size - 1].each_with_index do |f, i|
58
83
  cells = f.find_elements(:css, "td").map { |a| a.text.strip.gsub(",", "") }
59
84
  value = i if cells[1] == code and cells[3] == "東証"
60
85
  num += 1
@@ -62,7 +87,7 @@ module RakutenSecuritiesScraper
62
87
  while value == ""
63
88
  driver.find_element(xpath: "//*[@id='str-main-inner']/table/tbody/tr/td/table/tbody/tr/td/form/ul/li[2]/a").click
64
89
  rows = driver.find_elements(xpath: "//tr")
65
- rows[3..rows.size-1].each_with_index do |f, i|
90
+ rows[3..rows.size - 1].each_with_index do |f, i|
66
91
  cells = f.find_elements(:css, "td").map { |a| a.text.strip.gsub(",", "") }
67
92
  value = i + num - 1 if cells[1] == code and cells[3] == "東証"
68
93
  end
@@ -267,7 +292,7 @@ module RakutenSecuritiesScraper
267
292
  options.add_argument("--disable-popup-blocking")
268
293
  options.add_argument("--disable-translate")
269
294
  options.add_argument("-headless")
270
- Selenium::WebDriver.for :chrome, options: options
295
+ Selenium::WebDriver.for :chrome # , options: options
271
296
  end
272
297
  end
273
298
  end
@@ -1,3 +1,3 @@
1
1
  module RakutenSecuritiesScraper
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakuten_securities_scraper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - FUMI-POPPIN
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-08 00:00:00.000000000 Z
11
+ date: 2020-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler