From 5aa1854757e7a97f1574fd8f07a0eacabf998464 Mon Sep 17 00:00:00 2001 From: The Magician Date: Sun, 28 Apr 2024 19:58:48 +0100 Subject: [PATCH] Start writing code to get decklists --- sevenkeys/Makefile | 3 + sevenkeys/cmd/getdecks/main.go | 18 + sevenkeys/go.mod | 36 +- sevenkeys/go.sum | 717 ++++++++++++++++++++++++++++ sevenkeys/mtggoldfish/decksearch.go | 98 ++++ 5 files changed, 864 insertions(+), 8 deletions(-) create mode 100644 sevenkeys/cmd/getdecks/main.go create mode 100644 sevenkeys/mtggoldfish/decksearch.go diff --git a/sevenkeys/Makefile b/sevenkeys/Makefile index 800c5f3..5fb6744 100644 --- a/sevenkeys/Makefile +++ b/sevenkeys/Makefile @@ -5,3 +5,6 @@ createdb: mysql --user=root --password=$(shell pass show sevenkeys/mysql) thead>tr>th").Text(), + } + }) +} + +func DeckSearch(params DeckSearchParameters) (DeckSearchResults, error) { + searchUrl := `https://www.mtggoldfish.com/deck_searches/create?utf8=✓&deck_search[name]=Burn&deck_search[format]=pauper&deck_search[types][]=&deck_search[types][]=tournament&deck_search[types][]=user&deck_search[player]=Jirach1&deck_search[date_range]=04%2F14%2F2024+-+04%2F28%2F2024&deck_search[deck_search_card_filters_attributes][0][card]=Kuldotha+Rebirth&deck_search[deck_search_card_filters_attributes][0][quantity]=4&deck_search[deck_search_card_filters_attributes][0][type]=maindeck&deck_search[deck_search_card_filters_attributes][1][card]=&deck_search[deck_search_card_filters_attributes][1][quantity]=1&deck_search[deck_search_card_filters_attributes][1][type]=maindeck&deck_search[deck_search_card_filters_attributes][2][card]=&deck_search[deck_search_card_filters_attributes][2][quantity]=1&deck_search[deck_search_card_filters_attributes][2][type]=maindeck&counter=3&commit=Search` + fmt.Println(searchUrl) + + geziyor.NewGeziyor(&geziyor.Options{ + StartURLs: []string{searchUrl}, + ParseFunc: parseSearchResults, + Exporters: []export.Exporter{&export.JSON{}}, + }).Start() + + return DeckSearchResults{}, nil +}