|
5 | 5 | import java.net.URISyntaxException; |
6 | 6 | import java.util.ArrayList; |
7 | 7 | import java.util.Date; |
8 | | -import java.util.HashMap; |
9 | 8 | import java.util.List; |
10 | 9 | import java.util.Map; |
11 | 10 |
|
|
23 | 22 | public class MagicVilleDeckSniffer extends AbstractDeckSniffer { |
24 | 23 |
|
25 | 24 | private String baseUrl = "https://www.magic-ville.com/fr/decks/"; |
26 | | - private HashMap<String, String> mapCodes; |
27 | | - |
28 | | - public MagicVilleDeckSniffer() { |
29 | | - mapCodes = new HashMap<>(); |
30 | | - mapCodes.put("PIONEER", "resultats?data=1&dci=TP&tour_cur=1&tour_orig=1"); |
31 | | - mapCodes.put("MODERN", "resultats?data=1&dci=TM&tour_cur=1&tour_orig=1"); |
32 | | - mapCodes.put("STANDARD", "resultats?data=1&dci=T2&tour_cur=1&tour_orig=1"); |
33 | | - mapCodes.put("PEASANT", "resultats?data=1&alt=Peasant"); |
34 | | - mapCodes.put("COMMANDER", "resultats?data=1&dci=1vs1&tour_orig=1"); |
35 | | - mapCodes.put("LEGACY", "resultats?data=1&dci=T15&tour_cur=1&tour_orig=1"); |
36 | | - mapCodes.put("VINTAGE", "resultats?data=1&dci=T1&tour_cur=1&tour_orig=1"); |
37 | | - mapCodes.put("Brawl", "resultats?data=1&alt=Brawl"); |
38 | | - mapCodes.put("FUN", "resultats?data=1&fun=1"); |
39 | | - mapCodes.put("TINY LEADERS", "resultats?data=1&alt=TinyLeaders"); |
40 | | - mapCodes.put("EDH Peasant", "resultats?data=1&alt=EDHPeasant"); |
41 | | - } |
| 25 | + |
42 | 26 |
|
43 | 27 | @Override |
44 | 28 | public String[] listFilter() { |
45 | | - return mapCodes.keySet().stream().toArray(String[]::new); |
| 29 | + return new String[] { |
| 30 | + "PIONEER", |
| 31 | + "PREMODERN", |
| 32 | + "MODERN", |
| 33 | + "STANDARD", |
| 34 | + "PEASANT", |
| 35 | + "ALCHEMY", |
| 36 | + "LEGACY", |
| 37 | + "VINTAGE", |
| 38 | + "DC" |
| 39 | + }; |
46 | 40 | } |
47 | 41 |
|
48 | 42 | @Override |
@@ -75,8 +69,13 @@ public List<RetrievableDeck> getDeckList(String filter, MTGCard mc) throws IOExc |
75 | 69 | int maxPage = getInt("MAX_PAGE"); |
76 | 70 |
|
77 | 71 | for (var currPage = 0; currPage < maxPage; currPage++) { |
78 | | - var d = RequestBuilder.build().get().newClient() |
79 | | - .url(baseUrl + mapCodes.get(filter) + "&pointeur=" + currPage).toHtml(); |
| 72 | + var d = RequestBuilder.build().get().newClient().url(baseUrl + "resultats") |
| 73 | + .addContent("data","1") |
| 74 | + .addContent("dci", filter) |
| 75 | + .addContent("tour_cur","1") |
| 76 | + .addContent("tour_orig","1") |
| 77 | + .addContent("page_nb",""+currPage) |
| 78 | + .toHtml(); |
80 | 79 | Elements trs = d.select("tr[height=33]"); |
81 | 80 | for (Element tr : trs) { |
82 | 81 | Elements tds = tr.select("td"); |
|
0 commit comments