mirror of
https://github.com/dev-claw/vripper-project.git
synced 2026-08-19 08:35:41 +02:00
fixes #300
This commit is contained in:
@@ -171,9 +171,9 @@ internal abstract class Host(
|
|||||||
fun <T> fetch(
|
fun <T> fetch(
|
||||||
url: String,
|
url: String,
|
||||||
context: Context,
|
context: Context,
|
||||||
referer: String = "https://vipergirls.to/",
|
|
||||||
transformer: (ClassicHttpResponse) -> T
|
transformer: (ClassicHttpResponse) -> T
|
||||||
): T {
|
): T {
|
||||||
|
val referer = context.headers["Referer"] ?: "https://vipergirls.to/"
|
||||||
val httpGet =
|
val httpGet =
|
||||||
HttpGet(url).also {
|
HttpGet(url).also {
|
||||||
it.addHeader("Referer", referer)
|
it.addHeader("Referer", referer)
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ internal class ViprImHost : Host("vipr.im", 15) {
|
|||||||
.map { obj: Node -> obj.textContent }
|
.map { obj: Node -> obj.textContent }
|
||||||
.map { obj: String -> obj.trim() }.orElse(null)
|
.map { obj: String -> obj.trim() }.orElse(null)
|
||||||
val imgUrl = imgNode.attributes.getNamedItem("src").textContent.trim()
|
val imgUrl = imgNode.attributes.getNamedItem("src").textContent.trim()
|
||||||
|
context.headers["Referer"] = "https://vipr.im/"
|
||||||
Pair(imgTitle!!, imgUrl)
|
Pair(imgTitle!!, imgUrl)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
throw HostException("Unexpected error occurred", e)
|
throw HostException("Unexpected error occurred", e)
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ internal class ImageDownloadRunnable(
|
|||||||
cookieStore = HTTPService.cookieStore
|
cookieStore = HTTPService.cookieStore
|
||||||
}
|
}
|
||||||
val requests = mutableListOf<HttpUriRequestBase>()
|
val requests = mutableListOf<HttpUriRequestBase>()
|
||||||
|
val headers = mutableMapOf<String, String>()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
ApplicationProperties.VRIPPER_DIR.listDirectoryEntries()
|
ApplicationProperties.VRIPPER_DIR.listDirectoryEntries()
|
||||||
|
|||||||
Reference in New Issue
Block a user