...
This commit is contained in:
parent
98d4d3e463
commit
764025f1e7
@ -231,7 +231,7 @@ class ForeGroundService : Service() {
|
||||
|
||||
|
||||
TaskAggregator.refreshSystemInfo(applicationContext)
|
||||
|
||||
TaskAggregator.refreshNewsFeeds(applicationContext)
|
||||
// 1. 시스템 정보: 자주 변경되지 않으므로 1~3시간 간격
|
||||
val systemRequest = PeriodicWorkRequestBuilder<AggregatedSystemWorker>(PrefLong.longTimePeriod.get(120L), TimeUnit.MINUTES)
|
||||
.build()
|
||||
|
||||
@ -189,8 +189,8 @@ open class DcInside : RssDataInterface {
|
||||
} else if (dateTiem?.contains("-") == true) {
|
||||
val cal: Calendar = Calendar.getInstance()
|
||||
cal.setTime(Date())
|
||||
cal.set(Calendar.MONTH, dateTiem!!.split("-")[0].toInt() - 1)
|
||||
cal.set(Calendar.DAY_OF_MONTH, dateTiem!!.split("-")[1].toInt())
|
||||
// cal.set(Calendar.MONTH, dateTiem!!.split("-")[0].toInt() - 1)
|
||||
// cal.set(Calendar.DAY_OF_MONTH, dateTiem!!.split("-")[1].toInt())
|
||||
// cal.add(Calendar.DAY_OF_MONTH, -1)
|
||||
dateTiemL = cal.timeInMillis
|
||||
dateTiemL
|
||||
|
||||
@ -57,9 +57,9 @@ enum class RssDataType {
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getExcAdt() = arrayListOf(NEWSFEED, REDDIT, DOTAX, FMKORAE, DCINSIDE, RULIWEB, CLIEN, THEQOO, ARCA).map { it.name }
|
||||
fun getExcAdt() = arrayListOf(NEWSFEED, REDDIT, DOTAX, FMKORAE, DCINSIDE, RULIWEB, CLIEN, THEQOO).map { it.name }
|
||||
fun getAdts() = arrayListOf( REDDIT_NSFW).map { it.name }
|
||||
fun getAll() = arrayListOf(TORRENT, YOUTUBE, NEWSFEED, REDDIT, DOTAX, FMKORAE, DCINSIDE, RULIWEB, CLIEN, THEQOO, ARCA,PRIVATE,REDDIT_NSFW)
|
||||
fun getAll() = arrayListOf(YOUTUBE, NEWSFEED, REDDIT, DOTAX, FMKORAE, DCINSIDE, RULIWEB, CLIEN, THEQOO, PRIVATE,REDDIT_NSFW)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@ package bums.lunatic.launcher.workers
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import androidx.core.net.toUri
|
||||
import androidx.work.WorkerParameters
|
||||
import bums.lunatic.launcher.model.RssDataType
|
||||
import bums.lunatic.launcher.model.RuliWeb
|
||||
import bums.lunatic.launcher.model.getRssData
|
||||
@ -17,7 +16,7 @@ class RuliWebGetter(context: Context) : BaseGetter(context) {
|
||||
}
|
||||
|
||||
fun parseRuli(ruli_tr : org.jsoup.nodes.Element) {
|
||||
Blog.LOGE("ruli_tr >>> ${ruli_tr.text()}")
|
||||
// Blog.LOGE("ruli_tr >>> ${ruli_tr.text()}")
|
||||
var aTags = ruli_tr.getElementsByTag("a")
|
||||
var tagIdx = 0
|
||||
var pageLink = ""
|
||||
@ -33,6 +32,12 @@ class RuliWebGetter(context: Context) : BaseGetter(context) {
|
||||
}
|
||||
tagIdx = 1
|
||||
if(ruli_tr.getElementsByTag("a").size > tagIdx) { title = aTags.get(tagIdx).text() }
|
||||
if (title.isNullOrBlank()) {
|
||||
val link: org.jsoup.nodes.Element? = ruli_tr.selectFirst("a.subject_link.deco")
|
||||
if (link != null) {
|
||||
title = link.ownText().trim()
|
||||
}
|
||||
}
|
||||
tagIdx = 2
|
||||
if(ruli_tr.getElementsByTag("a").size > tagIdx) { desc = aTags.get(tagIdx).text().plus(" / ") }
|
||||
tagIdx = 3
|
||||
@ -57,6 +62,7 @@ class RuliWebGetter(context: Context) : BaseGetter(context) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Blog.LOGE("RULIWEB ${temp.size}")
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@ -65,7 +71,7 @@ class RuliWebGetter(context: Context) : BaseGetter(context) {
|
||||
RssDataType.RULIWEB.isOn {
|
||||
try {
|
||||
Blog.LOGE("realWork() ${this::class.simpleName}")
|
||||
val testUrl2 = arrayListOf("https://bbs.ruliweb.com/best/humor_only","https://bbs.ruliweb.com/best/humor_only/now?m=humor_only&t=default&page=2")
|
||||
val testUrl2 = arrayListOf("https://bbs.ruliweb.com/best/humor_only/now?range=24h","https://bbs.ruliweb.com/best/humor_only/now?range=24h&page=2")
|
||||
testUrl2.forEach { url ->
|
||||
Jsoup.connect(url).timeout(5000).ignoreHttpErrors(true)
|
||||
.userAgent(USAGT)
|
||||
|
||||
@ -94,6 +94,7 @@ object TaskAggregator {
|
||||
// 병렬로 네트워크 요청 쏘기 (시간 획기적으로 단축됨)
|
||||
val jobs = listOf(
|
||||
async { RuliWebGetter(context).fetchData() },
|
||||
async { TheQooGetter(context).fetchData() },
|
||||
async { YoutubeGetter(context).fetchData() },
|
||||
async { DCGetter(context).fetchData() },
|
||||
async { FmKoreaGetter(context).fetchData() },
|
||||
|
||||
@ -8,6 +8,7 @@ import bums.lunatic.launcher.model.TheQoo
|
||||
import bums.lunatic.launcher.model.getHref
|
||||
import bums.lunatic.launcher.model.getRssData
|
||||
import bums.lunatic.launcher.model.getT
|
||||
import bums.lunatic.launcher.utils.Blog
|
||||
import io.realm.kotlin.types.RealmObject
|
||||
import org.jsoup.Jsoup
|
||||
|
||||
@ -18,7 +19,7 @@ class TheQooGetter(context: Context) : BaseGetter(context) {
|
||||
|
||||
|
||||
fun parseTQoo(tq_tr : org.jsoup.nodes.Element) {
|
||||
// BLog.LOGE("tq_tr >>>> ${tq_tr}")
|
||||
Blog.LOGE("tq_tr >>>> ${tq_tr}")
|
||||
var desc = tq_tr.getElementsByClass("cate").getT()
|
||||
var title = tq_tr.getElementsByClass("title").getT()
|
||||
var pageLink = tq_tr.getElementsByTag("a").getHref()
|
||||
@ -53,17 +54,18 @@ class TheQooGetter(context: Context) : BaseGetter(context) {
|
||||
override fun realWork(): List<RealmObject> {
|
||||
RssDataType.THEQOO.isOn {
|
||||
try {
|
||||
val testUrl2 = arrayListOf("https://theqoo.net/hot","https://theqoo.net/hot/category/512000937","https://theqoo.net/hot/category/24784","https://theqoo.net/hot/category/24788")
|
||||
testUrl2.forEach { url ->
|
||||
Jsoup.connect(url)
|
||||
.userAgent(USAGT)
|
||||
.get().let { ruli ->
|
||||
// BLog.LOGE("test ${testUrl2} >> ${ruli.title()}")
|
||||
ruli.getElementsByTag("tr").forEach { ruli_tr ->
|
||||
parseTQoo(ruli_tr)
|
||||
}
|
||||
}
|
||||
}
|
||||
// val testUrl2 = arrayListOf("https://theqoo.net/hot")
|
||||
// testUrl2.forEach { url ->
|
||||
// Jsoup.connect(url)
|
||||
// .userAgent(USAGT)
|
||||
// .get().let { ruli ->
|
||||
// Blog.LOGE("THEQOO url ${url} >> ${ruli.title()} ${ruli.getElementsByTag("tr").text()}")
|
||||
//
|
||||
// ruli.getElementsByTag("tr").forEach { ruli_tr ->
|
||||
// parseTQoo(ruli_tr)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
} catch (e:Exception){e.printStackTrace()}}
|
||||
return temp
|
||||
}
|
||||
|
||||
@ -54,12 +54,7 @@
|
||||
android:text="newsfeed"
|
||||
style="@style/tableItem"
|
||||
android:layout_height="wrap_content"/>
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/arca"
|
||||
android:text="arca"
|
||||
style="@style/tableItem"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow android:id="@+id/normal_02" android:weightSum="3">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user