SetScrub 0.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_scrub.rb +32 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 90205507680de6c5614e784131ca593add4121d8437eefef87e0129107eac751
4
+ data.tar.gz: c3aafdafeebe7fb831f6aeeacc6946499c931d8afaf9f36376734576b81ef712
5
+ SHA512:
6
+ metadata.gz: 693227a8d8ee7ce02b8fecea9b8f6a98ffc2f45257fc45f542abb9ed2190dfca71a130fda3283785c650090b78144584c8903b5ed7b083e70e762b36c329671d
7
+ data.tar.gz: 11ab71f6e5a536359862e276da447f40bf9c20264b1272555ec6f9c7721887c64be3cb1fe199ef978e3106662ecd849f78c8fcb329194a450f9accb53c0d9904
data/lib/set_scrub.rb ADDED
@@ -0,0 +1,32 @@
1
+ # Pittayut Benjamasutin
2
+ # 6210545980
3
+
4
+ require "nokogiri"
5
+ require "open-uri"
6
+ require "byebug"
7
+
8
+ def scrapper
9
+ html = URI.open("https://www.set.or.th/set/commonslookup.do")
10
+ home = Nokogiri::HTML(html)
11
+ stock_listings = home.css("tr")[1..-1]
12
+ stock_pages = home.css("div.col-xs-12.padding-top-10.text-center.capital-letter").css("a")[0..-1]
13
+ stock_pages.each do |stock_paging|
14
+ url = "https://www.set.or.th" + stock_paging.attributes["href"].value
15
+ html = URI.open(url)
16
+ home = Nokogiri::HTML(html)
17
+ stock_listings = home.css("tr")[1..-1]
18
+ stock_listings.each do |stock_listing|
19
+ url = "https://www.set.or.th/set/companyhighlight.do?symbol=" + stock_listing.css("a")[0].text + "&ssoPageId=5&language=th&country=TH"
20
+ html = URI.open(url)
21
+ doc = Nokogiri::HTML(html)
22
+ print doc.css("h3").text + " : "
23
+ value = doc.css("tr").text.split("\n")[15]
24
+ if value != nil
25
+ print value.strip
26
+ end
27
+ puts ""
28
+ end
29
+ end
30
+ end
31
+
32
+ scrapper
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: SetScrub
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Pittayut (RitoruX)
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-02-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: SET's WebScraper
14
+ email: pittayut.b@ku.th
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/set_scrub.rb
20
+ homepage: https://rubygems.org/gems/set_scrub
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.2.3
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: SCRUB IT !!!
43
+ test_files: []