Showing
2 changed files
with
28 additions
and
1 deletions
... | @@ -9,6 +9,8 @@ const HTTPS = require('https'); | ... | @@ -9,6 +9,8 @@ const HTTPS = require('https'); |
9 | const domain = "2018102191.osschatbot2022.tk" | 9 | const domain = "2018102191.osschatbot2022.tk" |
10 | const sslport = 23023; | 10 | const sslport = 23023; |
11 | 11 | ||
12 | +var soccer = require('soccer.js'); | ||
13 | + | ||
12 | const bodyParser = require('body-parser'); | 14 | const bodyParser = require('body-parser'); |
13 | var app = express(); | 15 | var app = express(); |
14 | app.use(bodyParser.json()); | 16 | app.use(bodyParser.json()); |
... | @@ -26,6 +28,8 @@ app.post('/hook', function (req, res) { | ... | @@ -26,6 +28,8 @@ app.post('/hook', function (req, res) { |
26 | console.log('[request message]', eventObj.message); | 28 | console.log('[request message]', eventObj.message); |
27 | console.log("Receive Message : ", eventObj.message.text); | 29 | console.log("Receive Message : ", eventObj.message.text); |
28 | 30 | ||
31 | + console.log(soccer.GetPlayerInfo(33, 2019)); | ||
32 | + | ||
29 | request.post( | 33 | request.post( |
30 | { | 34 | { |
31 | url: TARGET_URL, | 35 | url: TARGET_URL, | ... | ... |
... | @@ -13,4 +13,27 @@ var options = { | ... | @@ -13,4 +13,27 @@ var options = { |
13 | request(options, function (error, response) { | 13 | request(options, function (error, response) { |
14 | if (error) throw new Error(error); | 14 | if (error) throw new Error(error); |
15 | console.log(response.body); | 15 | console.log(response.body); |
16 | -}); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
16 | +}); | ||
17 | + | ||
18 | +module.exports = function(){ | ||
19 | + this.GetPlayerInfo = function(playerID, season){ | ||
20 | + var request = require('request'); | ||
21 | + | ||
22 | + var options = { | ||
23 | + method: 'GET', | ||
24 | + url: 'https://v3.football.api-sports.io/players', | ||
25 | + qs: {id: '276', season: '2019'}, | ||
26 | + headers: { | ||
27 | + 'x-rapidapi-host': 'v3.football.api-sports.io', | ||
28 | + 'x-rapidapi-key': '526fc70a2e8b315e9a960ac4b4764191' | ||
29 | + } | ||
30 | + }; | ||
31 | + | ||
32 | + request(options, function (error, response) { | ||
33 | + if (error) throw new Error(error); | ||
34 | + console.log(response.body); | ||
35 | + | ||
36 | + return response.body; | ||
37 | + }); | ||
38 | + } | ||
39 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment