-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscrapeSmashgg.js
More file actions
59 lines (50 loc) · 1.55 KB
/
scrapeSmashgg.js
File metadata and controls
59 lines (50 loc) · 1.55 KB
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
56
57
58
59
/*
* scrapeSmashgg.js
* Daniel Posse
*
* Reads in a url string that is a smash.gg link
* sends data to database
*/
const axios = require('axios');
const cheerio = require('cheerio');
const scrapeSmashgg = async (url) => {
const smashResponse = await axios.get(url);
const $ = cheerio.load(smashResponse.data);
/**
* HTML layout of smash.gg brackets:
*
* 8 nested divs for whole bracket section?? class="bracket" and class="bracket-content"
*
* <div> //no class? but winners brackets
* <div> [bracket headers i.e. winners quarter final, semi final etc]</div>
* <div class="sgg2qW2i"> //randomly generated class?
* <svg></svg>
* ...
* <svg></svg> //multiple svgs that draw the lines that connect matches
*
*
* //HERE ARE THE DIVS WE WANT FOR NOW - here is the layout of one but there are many
* <div class="match has-identifier reportable" style="position: absolute; left: ...; top: ...; width: 180px;">
* <div class="match-affix-wrapper">
* <div class="match-section match-section-top">
* <div class="matchSectionWrapper">
*
* </div>
* </div>
* </div>
* </div>
*
* </div>
* </div>
*
* <div> //no class? but losers brackets
*
* </div>
*
*
*/
const matchDivs = $("div.match has-identifier reportable");
console.log(matchDivs);
};
//hard coded test
scrapeSmashgg('https://smash.gg/tournament/the-final-smash-invitational/events/ultimate-singles/brackets/483248/844548/');