@@ -8,9 +8,11 @@ import de.binarynoise.util.okhttp.hasInput
88import de.binarynoise.util.okhttp.parseHtml
99import de.binarynoise.util.okhttp.postForm
1010import de.binarynoise.util.okhttp.requestUrl
11+ import de.binarynoise.util.okhttp.toParameterMap
1112import okhttp3.Cookie
1213import okhttp3.OkHttpClient
1314import okhttp3.Response
15+ import org.jsoup.nodes.FormElement
1416
1517@SSID(" WIFI@DB" )
1618@Suppress(" SpellCheckingInspection" , " GrazieInspection" , " LocalVariableName" , " RedundantSuppression" )
@@ -55,10 +57,10 @@ object HotsplotsAuth : PortalLiberator {
5557 override fun solve (client : OkHttpClient , response : Response , cookies : Set <Cookie >) {
5658 val html1 = response.parseHtml()
5759
58- val login_status_form = html1.getElementById( " login_status_form " ) ? : error( " no login_status_form" )
59- val inputs = login_status_form.children( )
60- .associate { element -> element.attr( " name " ) to element.attr( " value " ) }
61- .filter { (name, _) -> name.isNotBlank() }
60+ val login_status_form = html1.getElementsByAttributeValue( " name " , " login_status_form" ).singleOrNull( )
61+ ? : error( " no login_status_form " )
62+ login_status_form as ? FormElement ? : error( " login_status_form is not a form " )
63+ val inputs = login_status_form.toParameterMap()
6264 check(inputs.isNotEmpty()) { " no inputs" }
6365
6466 client.postForm(
0 commit comments