Skip to content

Commit cbffcf4

Browse files
committed
added more stadium geos to baskeball mapper
1 parent 19097f9 commit cbffcf4

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

extraction-service/src/main/java/com/hespera/extraction/BasketballMapper.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,24 @@
44

55
public enum BasketballMapper {
66

7+
BOSTON (BasketballGeo.BOSTON_CELTICS),
78
CHARLOTTE (BasketballGeo.CHARLOTTE_BOBCATS),
89
DALLAS (BasketballGeo.DALLAS_MAVERICKS),
10+
DENVER (BasketballGeo.DENVER_NUGGETS),
911
DETROIT (BasketballGeo.DETROIT_PISTONS ),
1012
INDIANA (BasketballGeo.INDIANA_PACERS),
13+
LA_CLIPPERS (BasketballGeo.LOS_ANGELES_CLIPPERS),
14+
LA_LAKERS (BasketballGeo.LOS_ANGELES_LAKERS),
1115
MILWAUKEE (BasketballGeo.MILWAUKEE_BUCKS),
1216
MEMPHIS (BasketballGeo.MEMPHIS_GRIZZLIES),
1317
NEW_JERSEY (BasketballGeo.NEW_JERSEY_NETS),
18+
NEW_YORK (BasketballGeo.NEW_YORK_KNICKS),
19+
ORLANDO (BasketballGeo.ORLANDO_MAGIC),
1420
PHILADELPHIA (BasketballGeo.PHILADELPHIA_76ERS),
1521
PORTLAND (BasketballGeo.PORTLAND_TRAIL_BLAZERS),
1622
SAN_ANTONIO (BasketballGeo.SAN_ANTONIO_SPURS),
1723
TORONTO (BasketballGeo.TORONTO_RAPTORS),
24+
UTAH (BasketballGeo.UTAH_JAZZ),
1825
WASHINGTON (BasketballGeo.WASHINGTON_WIZARDS);
1926

2027
public final BasketballGeo team;

extraction-service/src/main/java/com/hespera/extraction/EspnGoComNBA.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class EspnGoComNBA extends Scraper {
2020

2121
private static final Pattern tablePattern = Pattern.compile("<table cellpadding=\"3\" cellspacing=\"1\" class=\"tablehead\"><tr class=\"stathead\">(.+?)</table>");
2222

23-
private static final Pattern entryPattern = Pattern.compile("<td><a href=\"(.+?)\">[a-zA-Z\\. ]+</a> at <a href=\"(.+?)\">[a-zA-Z\\. ]+</a></td><td align=\"right\">(<a href=\"/nba/preview\\?gameId=\\d+\">)?[a-zA-Z0-9 :]+(</a>)?</td>");
23+
private static final Pattern entryPattern = Pattern.compile("<td><a href=\"http://espn.go.com/nba/(.+?)\">[a-zA-z ]+</a> at <a href=\"http://espn.go.com/nba/team/(.+?)\">[a-zA-z ]+</a><br>(.+?)<a href=\"(.+?)\" >(.+?)</a></td><td align=\"right\">(<a href=\"(.+?)\">)?\\d{1,2}:\\d{2} [AP]M(</a>)?</td>");
2424
private static final Pattern datePattern = Pattern.compile("<td colspan=\"10\">[a-zA-z]+, [a-zA-z]+ \\d{1,2}</td>");
2525
private static final Pattern titlePattern = Pattern.compile("<a href=\"(.+?)\">[a-zA-Z\\. ]+</a> at <a href=\"(.+?)\">[a-zA-Z\\. ]+</a>");
2626
private static final Pattern timePattern = Pattern.compile("\\d{1,2}:\\d{2} [AP]M");
@@ -34,7 +34,8 @@ public static void main(String[] args) {
3434

3535
Matcher tableMatcher = tablePattern.matcher(content);
3636
while(tableMatcher.find()) {
37-
String table = content.substring(tableMatcher.start(), tableMatcher.end());
37+
String table = content.substring(tableMatcher.start(), tableMatcher.end());
38+
3839
// Extract date from table header
3940
String date = null;
4041
Matcher dateMatcher = datePattern.matcher(table);
@@ -48,12 +49,13 @@ public static void main(String[] args) {
4849
Matcher entryMatcher = entryPattern.matcher(table);
4950
while(entryMatcher.find()) {
5051
String entry = table.substring(entryMatcher.start(), entryMatcher.end());
51-
52+
System.out.println(entry);
5253
// Extract title from entry
5354
String title = null;
5455
Matcher titleMatcher = titlePattern.matcher(entry);
5556
if(titleMatcher.find()) {
5657
title = clean(entry.substring(titleMatcher.start(), titleMatcher.end()));
58+
title = title.replace("Tickets| Venue&nbsp;", "");
5759
}
5860

5961
// Extract time from entry

extraction-service/src/main/java/com/hespera/extraction/geo/BasketballGeo.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,24 @@
22

33
public enum BasketballGeo {
44

5+
BOSTON_CELTICS (-71.0646337, 42.3652917),
56
CHARLOTTE_BOBCATS (-80.8393335, 35.2250606),
67
DALLAS_MAVERICKS (-96.810159, 32.790442),
8+
DENVER_NUGGETS (-105.010407, 39.74691),
79
DETROIT_PISTONS (-83.2437214, 42.696511),
810
INDIANA_PACERS (-86.1604915, 39.7672589),
11+
LOS_ANGELES_CLIPPERS (-118.2668459, 34.043032),
12+
LOS_ANGELES_LAKERS (-118.2668459, 34.043032),
913
MEMPHIS_GRIZZLIES (-90.051885, 35.136686),
1014
MILWAUKEE_BUCKS (-87.917166, 43.043728),
1115
NEW_JERSEY_NETS (-73.9761879, 40.683267),
16+
NEW_YORK_KNICKS (-73.897424, 40.6778848),
17+
ORLANDO_MAGIC (-94.3686353, 41.6905061),
1218
PHILADELPHIA_76ERS (-75.1713324, 39.9042715),
1319
PORTLAND_TRAIL_BLAZERS (-122.667285, 45.531608),
1420
SAN_ANTONIO_SPURS (94.8930737, 27.4707784),
1521
TORONTO_RAPTORS (-79.3790852, 43.6436759),
22+
UTAH_JAZZ (-111.9011271, 40.7677204),
1623
WASHINGTON_WIZARDS (-77.0210577, 38.8975641);
1724

1825
public final double longitude;

0 commit comments

Comments
 (0)