Commit 7b124705 authored by jiahua.liu's avatar jiahua.liu

plugin supporting

parent 4dc6c3bf
...@@ -14,21 +14,16 @@ class ImageProvider { ...@@ -14,21 +14,16 @@ class ImageProvider {
val image: Deferred<Image> by lazy { val image: Deferred<Image> by lazy {
GlobalScope.async { GlobalScope.async {
//delay((Math.random() * 5000L).toLong())
class Result {
var id: String = ""
}
withTimeoutOrNull(5 * 1000) { withTimeoutOrNull(5 * 1000) {
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
val result = JSON.parseObject( val result = JSON.parseArray(
Jsoup.connect("http://dev.itxtech.org:10322/v2/randomImg.uue").ignoreContentType(true).timeout( Jsoup.connect("https://yande.re/post.json?limit=1&page=${(Math.random() * 10000).toInt()}").ignoreContentType(
true
).timeout(
10_0000 10_0000
).get().body().text(), ).get().body().text()
Result::class.java
) )
Jsoup.connect(result.getJSONObject(0).getString("jpeg_url"))
Jsoup.connect("http://dev.itxtech.org:10322/img.uue?size=large&id=${result.id}")
.userAgent("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; ja-jp) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27") .userAgent("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; ja-jp) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27")
.timeout(10_0000) .timeout(10_0000)
.ignoreContentType(true) .ignoreContentType(true)
...@@ -36,7 +31,7 @@ class ImageProvider { ...@@ -36,7 +31,7 @@ class ImageProvider {
.execute() .execute()
.bodyStream() .bodyStream()
} }
}?.uploadAsImage(contact) ?: error("Unable to download image") }?.uploadAsImage(contact) ?: error("Unable to download image|连接这个图站需要你的网络在外网")
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment