Skip to content

Commit 1729448

Browse files
committed
Update gradle to 8.3.2 and add User-Agent header to fix RobotEvents scraper
1 parent 3a164d0 commit 1729448

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

.idea/deploymentTargetDropDown.xml

Lines changed: 15 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/sunkensplashstudios/VRCRoboScout/RoboScoutAPI.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import io.ktor.client.engine.cio.CIO
66
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
77
import io.ktor.client.request.get
88
import io.ktor.client.request.header
9+
import io.ktor.client.request.headers
910
import io.ktor.client.statement.bodyAsText
1011
import kotlinx.coroutines.runBlocking
1112
import kotlinx.serialization.SerialName
@@ -18,11 +19,11 @@ import kotlinx.serialization.json.jsonArray
1819
import kotlinx.serialization.json.jsonObject
1920
import kotlinx.serialization.json.jsonPrimitive
2021
import org.ejml.data.DMatrixRMaj
22+
import org.ejml.dense.row.CommonOps_DDRM
23+
import org.ejml.simple.SimpleMatrix
2124
import java.text.SimpleDateFormat
2225
import java.util.Date
2326
import java.util.Locale
24-
import org.ejml.simple.SimpleMatrix
25-
import org.ejml.dense.row.CommonOps_DDRM
2627

2728
val API = RoboScoutAPI()
2829
val jsonWorker = Json {
@@ -291,6 +292,9 @@ class RoboScoutAPI {
291292
}
292293
}
293294
}
295+
headers {
296+
append("User-Agent", "Bond, James Bond")
297+
}
294298
}
295299

296300
println("RobotEvents Scraper (page ${params["page"] as? Int ?: 0}): $requestUrl")
@@ -301,7 +305,7 @@ class RoboScoutAPI {
301305
val matches = regex.findAll(response.bodyAsText())
302306

303307
for (match in matches) {
304-
skuArray.add(match.value.replace("https://www.robotevents.com/robot-competitions/vex-robotics-competition", "").replace(".html", ""))
308+
skuArray.add(match.value.replace("https://www.robotevents.com/robot-competitions/vex-robotics-competition/", "").replace(".html", ""))
305309
}
306310

307311
return skuArray

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
plugins {
3-
id("com.android.application") version "8.3.1" apply false
3+
id("com.android.application") version "8.3.2" apply false
44
id("org.jetbrains.kotlin.android") version "1.9.22" apply false
55
application
66
kotlin("jvm") version "1.4.21"

0 commit comments

Comments
 (0)