set_stock_bot 0.0.0

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 +7 -0
  2. data/lib/set_stock_bot.rb +27 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9cdbb1bddc870039e223356b51a4ced91e7bd2cd7da7436710250b27d0a5ec02
4
+ data.tar.gz: a10029bae1aed4276490204df0ca0007eb9a355a4993ca985debf712239c212a
5
+ SHA512:
6
+ metadata.gz: 66066ba2f78d10646d89cd15b89aaab3d0ba9864c64b9a560958b3e1170d3681f3bc12cc9beae82beb5047e8907104827a6a804be63573a8ff1ee572539294d0
7
+ data.tar.gz: 1a0fcfd9e12848585cd4281a2a356aa83683c802ff931e2fadbf78cf76404aa0cbd260e113fc1817bda6311eaad61725e9c18c8290967f1312b142104a71c56d
@@ -0,0 +1,27 @@
1
+ require 'nokogiri'
2
+ require 'open-uri'
3
+
4
+
5
+ url = 'https://www.set.or.th/set/commonslookup.do'
6
+ source = Nokogiri::HTML.parse(open(url))
7
+ i=5
8
+ while i < 32
9
+ i+=1
10
+ page = source.css("div#body-content div#maincontent div.row a")[i]["href"]
11
+ page2 = Nokogiri::HTML.parse(open("https://www.set.or.th" + page))
12
+ page2.css("tr")[1..-1].each do |set|
13
+ href = 'https://www.set.or.th/set/companyhighlight.do?symbol=' + set.css('td a').text + '&ssoPageId=5&language=th&country=TH#'
14
+ source2 = Nokogiri::HTML.parse(open(href))
15
+ if source2.css('td[5]')[0] != nil
16
+ if source2.css('td[5]')[0]["style"] == "background-color: #EAF0FE;"
17
+ puts set.css("td a").text + " : " + set.css("td[2]").text + " : " + source2.css('td[4]')[0]
18
+ next
19
+ end
20
+ puts set.css("td a").text + " : " + set.css("td[2]").text + " : " + source2.css('td[5]')[0]
21
+ else
22
+ puts set.css("td a").text + " : " + set.css("td[2]").text + " : " + "ไม่ระบุ"
23
+ end
24
+ end
25
+ end
26
+
27
+
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: set_stock_bot
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Kittitouch Ingkasompob
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-02-04 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple web scaping to check stock from www.set.or.th
14
+ email: kinkinkinxd@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/set_stock_bot.rb
20
+ homepage: https://rubygems.org/gems/stock_kinkinkinxd
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.0.3
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: A simple web scaping to check stock from www.set.or.th
43
+ test_files: []