Skip to content

Commit

Permalink
fix 403 for ORF
Browse files Browse the repository at this point in the history
  • Loading branch information
codingPF committed Jun 3, 2024
1 parent 11b633e commit 7c97087
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/main/java/de/mediathekview/mlib/tool/FileSizeDeterminer.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,22 @@ private Request.Builder createRequestBuilderForRequestType(final String url, fin
final Request.Builder requestBuilder;
switch (requestType) {
case GET:
requestBuilder = new Request.Builder().url(url).get();
requestBuilder = new Request.Builder()
.url(url)
.get()
.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3")
.addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
.addHeader("Accept-Language", "en-US,en;q=0.5")
.addHeader("Accept-Encoding", "gzip, deflate, br");
break;
case HEAD:
requestBuilder = new Request.Builder().url(url).head();
requestBuilder = new Request.Builder()
.url(url)
.head() // Indicates that this is a HEAD request
.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3")
.addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
.addHeader("Accept-Language", "en-US,en;q=0.5")
.addHeader("Accept-Encoding", "gzip, deflate, br");
break;
default:
throw new IllegalStateException("Unsupported request type for determining the file size.");
Expand Down

0 comments on commit 7c97087

Please sign in to comment.