set_scraping 0.0.2
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.
- checksums.yaml +7 -0
- data/set_scraping/lib/set_scraping.rb +36 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bd51823d6c96b5f85d742af9ef7cdc966fa1b91b4d9e1d2af376b029d517eb5b
|
4
|
+
data.tar.gz: 6543cdb88373d319354ffbdaf0dfa10f552bd2d23c3e453fdafe6ca8cd46ac8a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1a89ec8dd850d8694ab07331068082b48a2098bbb83db9a56e261a62ba9ad0162c9e65ebf8fd1fbe38a15dd3464a0f892dbd5885a5da545f422947c5760b0c8c
|
7
|
+
data.tar.gz: 882e278abd75a5933ee62ff4fff61f1ec19cf4eba86b304180144c90ffce7a3742bbcfcf83c0321588c03533054ce3ef297e0c2e97ebf24fb3c5341bac7e486d
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Chananya Photan
|
2
|
+
# 6110545481
|
3
|
+
|
4
|
+
require 'Nokogiri'
|
5
|
+
require 'open-uri'
|
6
|
+
|
7
|
+
main = 'https://www.set.or.th/'
|
8
|
+
all_company = 'https://www.set.or.th/set/commonslookup.do?language=th&country=TH&prefix='
|
9
|
+
all_alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
10
|
+
|
11
|
+
all_alphabet.each_char { |each_alphabet|
|
12
|
+
each_url_prefix = open(all_company + each_alphabet)
|
13
|
+
all_company_prefix = Nokogiri::HTML(each_url_prefix)
|
14
|
+
# Get all info url of company from each alphabet
|
15
|
+
all_company_info = all_company_prefix.xpath('//*[@id="maincontent"]/div/div/div[3]/table').css('a').map { |l| l['href'] }
|
16
|
+
|
17
|
+
all_company_info.each do |each_company_info|
|
18
|
+
company_info = open(main + each_company_info)
|
19
|
+
new_source = Nokogiri::HTML(company_info)
|
20
|
+
# Get Profit url of each company
|
21
|
+
all_profits_path = new_source.xpath('//*[@id="maincontent"]/div/div[2]/div/ul/li[2]/a').map { |l| l['href'] }
|
22
|
+
|
23
|
+
all_profits_path.each do |each_profits_path|
|
24
|
+
# Open profit path of each company
|
25
|
+
each_company_profits = open(main + each_profits_path)
|
26
|
+
profits_source = Nokogiri::HTML(each_company_profits)
|
27
|
+
# Get company's name
|
28
|
+
company_name = profits_source.xpath('//*[@id="maincontent"]/div/div[1]/div[1]/h3').text
|
29
|
+
# Get company's asset
|
30
|
+
company_asset = profits_source.xpath('//*[@id="maincontent"]/div/div[4]/table/tbody[1]/tr[2]/td[5]').text
|
31
|
+
puts '%s : ' % company_name + company_asset
|
32
|
+
end
|
33
|
+
end
|
34
|
+
}
|
35
|
+
|
36
|
+
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: set_scraping
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chananya Photan 6110545481
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-02-03 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: The asset of each company sort by alphabet in set.or.th
|
14
|
+
email: chananya.pho@ku.th
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- set_scraping/lib/set_scraping.rb
|
20
|
+
homepage: https://rubygems.org/gems/set_scraping
|
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: Asset of each company
|
43
|
+
test_files: []
|