-
Notifications
You must be signed in to change notification settings - Fork 0
/
temp.js
50 lines (40 loc) · 1.16 KB
/
temp.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*const axios=require('axios');
const cheerio=require('cheerio');
const options={
headers: {
'accept-language': ' zh-TW,zh;q=0.9,en-US;q=0.8,en;q=0.7',
'user-agent': ' Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36',
}
};
(async ()=>{
let res=await axios.get("https://www.cwb.gov.tw/V8/C/L/Surfing/Surfing.html?PID=O001", options);
const $=cheerio.load(res.data);
let table=$("#Table3hrMMC");
console.log("===========================");
console.log($(table).text());
console.log("===========================");
})();*/
//connecting-heroku-postgres
const {Client}=require('pg');
const clientPostgres=new Client({
connectionString: process.env.DATABASE_URL,
ssl: {
rejectUnauthorized: false
}
});
clientPostgres.connect();
//connecting-heroku-postgres
//開chrome
const puppeteer=require('puppeteer');
let browser;
//開chrome
const cwb=require("./modules/cwb");
(async ()=>{
browser=await puppeteer.launch({
headless: true,
args: ['--no-sandbox', '--disable-setuid-sandbox']
});
let echo=await cwb("北堤", clientPostgres, browser);
console.log(typeof echo);
console.log(echo);
})();