initial commit

This commit is contained in:
Juul
2025-08-23 00:01:19 +02:00
commit 118278b139
3 changed files with 98 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/*
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>cst-name-grabber</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
+46
View File
@@ -0,0 +1,46 @@
package org.example;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.zip.GZIPInputStream;
public class Main {
public static void main(String[] args) throws InterruptedException, IOException {
final URI uri = URI.create("https://coomer.st/api/v1/fansly/user/372647979531644928/posts");
HttpResponse<byte[]> response = makeRequest(uri);
decompress(response.body());
}
public static HttpResponse<byte[]> makeRequest(URI uri) throws IOException, InterruptedException {
HttpClient httpClient = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(uri)
.header("Accept", "text/css")
.header("Accept-Encoding", "gzip, deflate, br, zstd")
.build();
return httpClient.send(request, HttpResponse.BodyHandlers.ofByteArray());
}
public static void decompress(byte[] responseBody) throws IOException {
GZIPInputStream gzipInputStream = new GZIPInputStream(new ByteArrayInputStream(responseBody));
InputStreamReader reader = new InputStreamReader(gzipInputStream);
BufferedReader buffer = new BufferedReader(reader);
String line;
while((line = buffer.readLine()) != null) {
System.out.println(line);
}
}
}