scantrad userAgent3 (#5577)

* scantrad userAgent3

look like the random int only called once and being used again causing repeated number

* min 2/3 digit

* referer
This commit is contained in:
Riztard Lanthorn 2021-01-28 18:59:40 +07:00 committed by GitHub
parent c362834c84
commit 9dc679a036
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Scantrad'
pkgNameSuffix = 'fr.scantrad'
extClass = '.Scantrad'
extVersionCode = 11
extVersionCode = 12
libVersion = '1.2'
}

View File

@ -42,11 +42,17 @@ class Scantrad : ParsedHttpSource() {
.addNetworkInterceptor(rateLimitInterceptor)
.build()
protected open val userAgentRandomizer = "${Random.nextInt(9).absoluteValue}"
protected open val uAR = userAgentRandomizer
protected open val userAgentRandomizer1 = "${Random.nextInt(9).absoluteValue}"
protected open val userAgentRandomizer2 = "${Random.nextInt(10,99).absoluteValue}"
protected open val userAgentRandomizer3 = "${Random.nextInt(100,999).absoluteValue}"
override fun headersBuilder() = Headers.Builder().apply {
add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/8$uAR.0.4$uAR$uAR$uAR.1$uAR$uAR Safari/537.36")
add("Referer", baseUrl)
add(
"User-Agent",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " +
"Chrome/8$userAgentRandomizer1.0.4$userAgentRandomizer3.1$userAgentRandomizer2 Safari/537.36"
)
}
// Popular