Android Question WebView Error: ResponseError. Reason: , Response: <!DOCTYPE html>


Hello. I'm trying to extract parts of web pages and load them into a webview, but for some reason it doesn't work. Please help!

Error: ResponseError. Reason: , Response: <!DOCTYPE html>

Private Sub CargarReparto
    Dim http As HttpJob
    http.initialize("", Me)
    Wait For (http) jobdone(j As HttpJob)
    If j.Success Then
        Dim str As String = j.GetString
        Dim s1 As Int = str.IndexOf($"<section class="panel top_billed scroller">"$)
        Dim s2 As Int = str.IndexOf2($"</section>"$, s1)
        str = str.SubString2(s1, s2)
        Log("s1:" & s1)
        Log("s2:" & s2)
    End If
End Sub


What is the output of Log(j.ErrorMessage)?
** Activity (main) Resume **
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
ResponseError. Reason: , Response: <!DOCTYPE html>
<html lang="en" class="no-js">
<title>Request Error (403) - The Movie Database (TMDb)</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="cleartype" content="on">
<meta charset="utf-8">
<meta name="robots" content="noindex">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=1120">
<meta name="theme-color" content="#032541">
<link rel="apple-touch-icon" sizes="180x180" href="/assets/2/apple-touch-icon-57ed4b3b0450fd5e9a0c20f34e814b82adaa1085c79bdde2f00ca8787b63d2c4.png">
<link rel="icon" type="image/png" sizes="32x32" href="/assets/2/favicon-32x32-543a21832c8931d3494a68881f6afcafc58e96c5d324345377f3197a37b367b5.png">
<link rel="icon" type="image/png" sizes="16x16" href="/assets/2/favicon-16x16-b362d267873ce9c5a39f686a11fe67fec2a72ed25fa8396c11b71aa43c938b11.png">
<link rel="preload" href="/assets/2/source-sans-pro-v14-vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic-regular-f38472b9e378b8c936f55a92677f575ab69e414d7cc3706ecfefeacd994b7975.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/assets/2/source-sans-pro-v14-vietnamese_latin-ext_latin_greek-ext_greek_cyrillic-ext_cyrillic-italic-48273a74acbc1611b6ef1d0a771bb8ef042b9922b51d5bff560571dddcb5542a.woff2" as="font" type="font/woff2" crossorigin>
Upvote 0


Codigo de error 403 - solicitud prohibida.

Puede estar relacionado con el agente de usuario predeterminado. Intente cambiarlo:

I tried various ways but it didn't work. I used several agents but none worked for me.

Dim wvs As WebViewSettings
    'initialize wvs here
    'wv = webview

    Dim UA As String
    UA = "Mozilla/5.0 (Linux; Android 9; SM-G973U Build/PPR1.180610.011) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Mobile Safari/537.36" 'or set any of the useragents listed below
    wvs.setUserAgentString( WebView1,UA)
Upvote 0