diff --git a/src/main/kotlin/kr/lunaticbum/back/lun/model/BumsPrivate.kt b/src/main/kotlin/kr/lunaticbum/back/lun/model/BumsPrivate.kt index 2a95209..74e420b 100644 --- a/src/main/kotlin/kr/lunaticbum/back/lun/model/BumsPrivate.kt +++ b/src/main/kotlin/kr/lunaticbum/back/lun/model/BumsPrivate.kt @@ -1,6 +1,7 @@ package kr.lunaticbum.back.lun.model import com.google.gson.Gson +import kr.lunaticbum.back.lun.configs.GlobalEnvironment import kr.lunaticbum.back.lun.utils.LogService import lombok.AllArgsConstructor import lombok.Data @@ -14,6 +15,7 @@ import org.springframework.data.mongodb.core.mapping.Document import org.springframework.data.mongodb.repository.ReactiveMongoRepository import org.springframework.stereotype.Repository import org.springframework.stereotype.Service +import org.springframework.web.reactive.function.client.WebClient import reactor.core.publisher.Mono import java.text.SimpleDateFormat import java.util.* @@ -243,6 +245,7 @@ object QVZTb2dpcmw : SoInterface { return String(Base64.getMimeDecoder().decode(this.javaClass.simpleName.plus("==").toByteArray())) } override fun parse(doc : org.jsoup.nodes.Document, service : RssDataService) { + var lists = arrayListOf() doc.getElementsByTag("article").forEach { article -> val title = article.getElementsByTag("a").get(0).attr("title") @@ -257,6 +260,9 @@ object QVZTb2dpcmw : SoInterface { this.category = RssDataType.GURU.name }) } + service.sendMsg(lists.map { + "${it.title}\n${it.description}\n${it.thumbnail}\n${it.originPage}\n" + }.joinToString(" \n ")) } } @@ -266,6 +272,7 @@ object SkFWTW9zdA : SoInterface { return String(Base64.getMimeDecoder().decode(this.javaClass.simpleName.plus("==").toByteArray())) } override fun parse(doc: org.jsoup.nodes.Document, service: RssDataService) { + var lists = arrayListOf() doc.getElementsByClass("card").forEach { card -> var thumb = if(card.getElementsByTag("img").size > 0) card.getElementsByTag("img").get(0).attr("src") else "" if (thumb.contains("No+Poster")) thumb = if(card.getElementsByTag("img").size > 0) card.getElementsByTag("img").get(0).attr("data-src") else thumb @@ -275,6 +282,7 @@ object SkFWTW9zdA : SoInterface { val title = card.getElementsByClass("card-block").get(0).getElementsByTag("a").get(0).attr("title") val date = card.getElementsByTag("span").get(0).text() service.save(RssData().apply { + lists.add(this) description = model thumbnail = thumb originPage = link @@ -286,6 +294,9 @@ object SkFWTW9zdA : SoInterface { }) } } + service.sendMsg(lists.map { + "${it.title}\n${it.description}\n${it.thumbnail}\n${it.originPage}\n" + }.joinToString(" \n ")) } } @Repository @@ -323,4 +334,14 @@ class RssDataService { } } } + @Autowired + lateinit var globalEvv : GlobalEnvironment + + fun sendMsg(data : String) { + val client = WebClient.create() + client.get() + .uri("https://api.telegram.org/${globalEvv.telegramBotKey}/sendMessage?chat_id=${globalEvv.telegramMyId}&text=${data}") + .retrieve() + .bodyToMono(String::class.java).block() ?: "FAIL" + } } \ No newline at end of file diff --git a/src/main/resources/static/css/common.css b/src/main/resources/static/css/common.css index e93d26b..14c67fa 100644 --- a/src/main/resources/static/css/common.css +++ b/src/main/resources/static/css/common.css @@ -23,7 +23,6 @@ header { width: 100%; align-content: center; position: relative; - background-color: Gray; height: var(--TopHeight); background-image: url("../blog/post/images/42cc3207-42a4-4ceb-8a2f-f5f7a89496fc.jpg"); background-repeat: revert;