stockjusta 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/stockjusta.rb +28 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7bc8d0433593f444e4301b41d2ae9f68fdd459d8c7ef9f4c019e77d90dc6bb1d
4
+ data.tar.gz: 29fab62b9dead771b3fb80e15e34fb996b3e8c89d3c9c5d4e964bf5809f7b6cc
5
+ SHA512:
6
+ metadata.gz: dec94b8aebf27a35c5ca0ab790809bcdd94306817d325ea667a8df42f31b8df4647d177ceb6cac18317bf89928666543e359695d7618b453aca4a10ae426f022
7
+ data.tar.gz: c4beec381173f8b33ed82ee470f4712182ad3e6317837e59a939c926305c58ad5a65cb1b5b5f8f5133a9a2fbab5cebbc5c00d45464b37b468a363351d3aa0003
data/lib/stockjusta.rb ADDED
@@ -0,0 +1,28 @@
1
+ # Jakkrathorn Srisawad
2
+ # 6210545432
3
+ require 'open-uri'
4
+ require 'Nokogiri'
5
+
6
+ class StockJustA
7
+ def self.scraper
8
+ n = 0
9
+ url = "https://www.set.or.th/set/commonslookup.do"
10
+ unp_page = URI.open(url)
11
+ p_page = Nokogiri::HTML(unp_page)
12
+ companies = Array.new
13
+ company_listings = p_page.css('tr')
14
+ company_listings.each do |company_lsitings|
15
+ name = Nokogiri::HTML(URI.open("https://www.set.or.th"+company_listings.css('td a')[n].values[0])).css('div.row').css('h3').text
16
+ url = "https://www.set.or.th"+company_listings.css('td a')[n].values[0]
17
+ url["profile"] = "highlight"
18
+ highlight = Nokogiri::HTML(URI.open(url)).css('#maincontent > div > div.table-responsive > table > tbody:nth-child(3) > tr:nth-child(2) > td:nth-child(5)').text
19
+ if highlight.empty?
20
+ highlight = "ไม่มีบอกไว้"
21
+ end
22
+ n+=1
23
+ puts name + " : " + highlight
24
+ rescue NoMethodError
25
+ end
26
+ end
27
+ end
28
+
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stockjusta
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jakkrathorn Srisawad
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-02-04 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Scrap company name and Total Asset Q3 of company with Preceded by a letter
14
+ a
15
+ email: thornny.s@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/stockjusta.rb
21
+ homepage: http://rubygems.org/gems/stockjusta
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubygems_version: 3.2.3
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: StockJustAAAA
44
+ test_files: []