Skip to content

Commit

Permalink
fetch thingy
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyline300 committed Jan 12, 2025
1 parent 616faa8 commit ea5699d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/main/scala/com/skyline/warlangmod/App.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.skyline.warlangmod

import scala.util.Try

object App {
def runOffline(inputFileName: String, originalFile: String, outputFileName: String): Unit = {

Expand All @@ -20,8 +22,9 @@ object App {
val parsingService = ParsingService.instance
val translationOverwrite = TranslationOverwriteService.instance
val outputService = Output.instance


Try {
FetchService.fetchFile(filePath)
}

}
}
8 changes: 5 additions & 3 deletions src/main/scala/com/skyline/warlangmod/FetchService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,22 @@ import java.io.FileWriter


object FetchService {
def fetchFile(): Unit = {
def fetchFile(url: String): Unit = {
val client = HttpClient
.newBuilder()
.proxy(ProxySelector.getDefault)
.build()

val httpReq = HttpRequest.newBuilder()
.uri(new URI("https://raw.githubusercontent.com/gszabi99/War-Thunder-Datamine/1bc153b0d22ac06719f6ce1ba2c25b567285cc99/lang.vromfs.bin_u/lang/units.csv"))
.uri(new URI(url))
.timeout(Duration.ofSeconds(20))
.GET()
.build()

val response = client.send(httpReq,BodyHandlers.ofString())
val body = response.body()

val fileWriter = new FileWriter("src/output.csv")
val fileWriter = new FileWriter("src/test.csv")
fileWriter.write(body)
fileWriter.close()
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/com/skyline/warlangmod/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ object Main extends CommandApp(
} else {
// program will fetch a file from the github repository
println("------Running Online------")
App.runOnline(inputFileName,"some gay shit")
App.runOnline(inputFileName,defaultUnitsLink)
}
}
}
Expand Down

0 comments on commit ea5699d

Please sign in to comment.