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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +5 -0
- data/lib/rakuten_securities_scraper.rb +29 -4
- data/lib/rakuten_securities_scraper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af1bd8cc0abba9b3116e6636a63ca1c2e8444cef3dcd235302bdf42eb7dd6836
|
4
|
+
data.tar.gz: a9a10da8d97ce4988b601bc9fcf75329e6782a865636478f679fe0751d582060
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74b63aebc080956c50f098e7bf699ceb19f8b0699b701f1e20aeaafd3361ef7c0ef266ae6fd5442944980ffa83fd007400c9383af2c61e9dea27b0fd964f1c75
|
7
|
+
data.tar.gz: '0961d672f7f487d62464a3a2a4ce16adb04bcd6ddc7f7e53b640b24a7dcefbb49795196db45f814e7593c14e9ef2a5caf144430e8b422c44f58b779e2f449813'
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -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
|
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.
|
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-
|
11
|
+
date: 2020-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|