vlr-stats-scraper 1.2.0 → 1.3.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.
- package/package.json +1 -1
- package/scripts/player-info-scraper.mjs +12 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vlr-stats-scraper",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Scrapes player stats from vlr.gg and stores them in a local SQLite database, grouped by tournament or stage.",
|
|
5
5
|
"homepage": "https://github.com/OverYander/VLR-Webscraper#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -15,7 +15,7 @@ function getClient() {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
async function scrapePlayer(url, region) {
|
|
18
|
-
console.log('scrapePlayer ran')
|
|
18
|
+
// console.log('scrapePlayer ran')
|
|
19
19
|
try {
|
|
20
20
|
const scrapeData = await getClient().scrape.startAndWait({
|
|
21
21
|
url: url,
|
|
@@ -51,12 +51,13 @@ node scripts/player-info-scraper.mjs
|
|
|
51
51
|
*/
|
|
52
52
|
|
|
53
53
|
function getPlayerName(link) {
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
let name = link.substring(link.lastIndexOf('/') + 1)
|
|
55
|
+
console.log(name)
|
|
56
|
+
return name
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
function findAgents($) {
|
|
59
|
-
console.log('findAgents ran')
|
|
60
|
+
// console.log('findAgents ran')
|
|
60
61
|
const header = $('.mod-agent-rows').first().children().first()
|
|
61
62
|
|
|
62
63
|
const statCategories = header.text().split('\n').map(ele => ele.trim()).filter(ele => ele !== '')
|
|
@@ -87,14 +88,14 @@ function findAgents($) {
|
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
function getCurTeam($) {
|
|
90
|
-
console.log('getCurTeam ran')
|
|
91
|
+
// console.log('getCurTeam ran')
|
|
91
92
|
const currentTeam = $('h2:contains("Current Teams")').first().next().text().trim()
|
|
92
93
|
const currentTeamName = currentTeam.split('\t').filter(ele => ele.trim() !== '')
|
|
93
94
|
return currentTeamName[0].trim()
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
function getPastTeam($) {
|
|
97
|
-
console.log('getPastTeam ran')
|
|
98
|
+
// console.log('getPastTeam ran')
|
|
98
99
|
const pastTeams = $('h2:contains("Past Teams")').first().next().text().trim()
|
|
99
100
|
const pastTeamNames = pastTeams.split('\t').filter(ele => ele.trim() !== ''
|
|
100
101
|
&& !ele.includes('joined')
|
|
@@ -105,18 +106,18 @@ function getPastTeam($) {
|
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
function getWinnings($) {
|
|
108
|
-
console.log('getWinnings ran')
|
|
109
|
+
// console.log('getWinnings ran')
|
|
109
110
|
const events = $('h2:contains("Event Placements")').first().next()
|
|
110
111
|
const winnings = events.children().first().text().trim()
|
|
111
|
-
// console.log(winnings.split('\t').map(ele => ele.trim()).filter(ele => ele !== '')[1])
|
|
112
|
+
// // console.log(winnings.split('\t').map(ele => ele.trim()).filter(ele => ele !== '')[1])
|
|
112
113
|
return winnings.split('\t').map(ele => ele.trim()).filter(ele => ele !== '')[1]
|
|
113
114
|
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
function getNationality($) {
|
|
117
|
-
console.log('getNationality ran')
|
|
118
|
+
// console.log('getNationality ran')
|
|
118
119
|
const header = $('.flag').first()
|
|
119
|
-
console.log('flags found:', $('.flag').length);
|
|
120
|
-
console.log(header.parent().text().trim())
|
|
120
|
+
// console.log('flags found:', $('.flag').length);
|
|
121
|
+
// console.log(header.parent().text().trim())
|
|
121
122
|
return header.parent().text().trim()
|
|
122
123
|
}
|