loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.5110850667936333","path":"index.js","file":{"path":"index.js","content":{"asEncoding":{"base64":"Y29uc3QgYXhpb3MgPSByZXF1aXJlKCdheGlvcycpCgovLyBBbiBhcGkga2V5IGlzIGVtYWlsZWQgdG8geW91IHdoZW4geW91IHNpZ24gdXAgdG8gYSBwbGFuCmNvbnN0IGFwaV9rZXkgPSAnWU9VUl9BUElfS0VZJwoKLy8gR2V0IGEgbGlzdCBvZiBpbiBzZWFzb24gc3BvcnRzCmF4aW9zLmdldCgnaHR0cHM6Ly9hcGkudGhlLW9kZHMtYXBpLmNvbS92My9zcG9ydHMnLCB7CiAgICBwYXJhbXM6IHsKICAgICAgICBhcGlfa2V5OiBhcGlfa2V5CiAgICB9Cn0pLnRoZW4ocmVzcG9uc2UgPT4gewoKICAgIGNvbnNvbGUubG9nKAogICAgICAgIGBTdWNjZXNzZnVsbHkgZ290ICR7cmVzcG9uc2UuZGF0YS5kYXRhLmxlbmd0aH0gc3BvcnRzLmAsCiAgICAgICAgYEhlcmUncyB0aGUgZmlyc3Qgc3BvcnQ6YAogICAgKQoKICAgIGNvbnNvbGUubG9nKHJlc3BvbnNlLmRhdGEuZGF0YVswXSkKfSkKLmNhdGNoKGVycm9yID0+IHsKICAgIGNvbnNvbGUubG9nKCdFcnJvciBzdGF0dXMnLCBlcnJvci5yZXNwb25zZS5zdGF0dXMpCiAgICBjb25zb2xlLmxvZyhlcnJvci5yZXNwb25zZS5kYXRhKQp9KQoKLy8gVG8gZ2V0IG9kZHMgZm9yIGEgc2VwY2lmaWMgc3BvcnQsIHVzZSB0aGUgc3BvcnQga2V5IGZyb20gdGhlIGxhc3QgcmVxdWVzdAovLyAgIG9yIHNldCBzcG9ydCB0byAidXBjb21pbmciIHRvIHNlZSBsaXZlIGFuZCB1cGNvbWluZyBhY3Jvc3MgYWxsIHNwb3J0cwpsZXQgc3BvcnRfa2V5ID0gJ3VwY29taW5nJwoKYX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JywgZXJyb3IucmVzcG9uc2Uuc3RhdHVzKQogICAgY29uc29sZS5sb2coZXJyb3IucmVzcG9uc2UuZGF0YSkKfSk="},"asBuffer":null},"loaded":true}}
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
51
52
53
54
55
const axios = require('axios')

// An api key is emailed to you when you sign up to a plan
const api_key = 'YOUR_API_KEY'

// Get a list of in season sports
axios.get('https://api.the-odds-api.com/v3/sports', {
    params: {
        api_key: api_key
    }
}).then(response => {

    console.log(
        `Successfully got ${response.data.data.length} sports.`,
        `Here's the first sport:`
    )

    console.log(response.data.data[0])
})
.catch(error => {
    console.log('Error status', error.response.status)
    console.log(error.response.data)
})

// To get odds for a sepcific sport, use the sport key from the last request
//   or set sport to "upcoming" to see live and upcoming across all sports
let sport_key = 'upcoming'

axios.get('https://api.the-odds-api.com/v3/odds', {
    params: {
        api_key: api_key,
        sport: sport_key,
        region: 'uk', // uk | us | au
        mkt: 'h2h' // h2h | spreads | totals
    }
}).then(response => {
    // odds_json['data'] contains a list of live and 
    //   upcoming events and odds for different bookmakers.
    // Events are ordered by start time (live events are first)
    console.log(
        `Successfully got ${response.data.data.length} events`,
        `Here's the first event:`
    )
    console.log(JSON.stringify(response.data.data[0]))

    // Check your usage
    console.log()
    console.log('Remaining requests',response.headers['x-requests-remaining'])
    console.log('Used requests',response.headers['x-requests-used'])

})
.catch(error => {
    console.log('Error status', error.response.status)
    console.log(error.response.data)
})
node v10.16.0