This commit is contained in:
lunaticbum 2025-07-23 10:43:45 +09:00
parent 6cb5ea9b15
commit 2719b7d291
17 changed files with 414 additions and 359 deletions

View File

@ -208,7 +208,7 @@ function scrollByPercent(current , max) {
document.documentElement.clientHeight document.documentElement.clientHeight
); );
const currentScroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; const currentScroll = window.scrollY || document.documentElement.scrollTop || document.body.scrollTop || 0;
const moveAmount = pageHeight / max; const moveAmount = pageHeight / max;
window.scrollTo({ top: moveAmount * current, behavior: "smooth" }); window.scrollTo({ top: moveAmount * current, behavior: "smooth" });
} }
@ -222,7 +222,7 @@ function scrollByPercentUpDown(isToDown , max) {
document.body.clientHeight, document.body.clientHeight,
document.documentElement.clientHeight document.documentElement.clientHeight
); );
const currentScroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; const currentScroll = window.scrollY || document.documentElement.scrollTop || document.body.scrollTop || 0;
const moveAmount = Math.max(pageHeight / max,150); const moveAmount = Math.max(pageHeight / max,150);
window.scrollTo({ top: currentScroll + (moveAmount * isToDown) , behavior: "smooth" }); window.scrollTo({ top: currentScroll + (moveAmount * isToDown) , behavior: "smooth" });
} }

View File

@ -21,9 +21,7 @@ package bums.lunatic.launcher
//import rasel.lunar.launcher.home.LauncherHome.Companion.rssSet //import rasel.lunar.launcher.home.LauncherHome.Companion.rssSet
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.NotificationManager
import android.appwidget.AppWidgetManager import android.appwidget.AppWidgetManager
import android.content.ComponentName
import android.content.Intent import android.content.Intent
import android.content.SharedPreferences import android.content.SharedPreferences
import android.content.res.Configuration import android.content.res.Configuration
@ -31,10 +29,8 @@ import android.graphics.Color
import android.net.Uri import android.net.Uri
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.os.Environment.isExternalStorageManager
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.provider.Settings
import android.view.KeyEvent import android.view.KeyEvent
import android.view.KeyEvent.ACTION_UP import android.view.KeyEvent.ACTION_UP
import android.view.KeyEvent.KEYCODE_BUTTON_A import android.view.KeyEvent.KEYCODE_BUTTON_A
@ -46,19 +42,14 @@ import android.view.KeyEvent.KEYCODE_BUTTON_Y
import android.view.KeyEvent.KEYCODE_DPAD_DOWN import android.view.KeyEvent.KEYCODE_DPAD_DOWN
import android.view.KeyEvent.KEYCODE_DPAD_UP import android.view.KeyEvent.KEYCODE_DPAD_UP
import android.view.MotionEvent import android.view.MotionEvent
import android.view.View
import android.view.WindowInsets import android.view.WindowInsets
import android.view.WindowManager import android.view.WindowManager
import androidx.activity.OnBackPressedCallback import androidx.activity.OnBackPressedCallback
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
import androidx.core.net.toUri import androidx.core.net.toUri
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.ViewCompat import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsCompat
import androidx.core.view.isVisible
import androidx.core.view.updatePadding import androidx.core.view.updatePadding
import androidx.work.ExistingPeriodicWorkPolicy import androidx.work.ExistingPeriodicWorkPolicy
import androidx.work.OneTimeWorkRequest import androidx.work.OneTimeWorkRequest
@ -70,8 +61,6 @@ import bums.lunatic.launcher.tokiz.Novels
import bums.lunatic.launcher.common.CommonActivity import bums.lunatic.launcher.common.CommonActivity
import bums.lunatic.launcher.databinding.LauncherActivityBinding import bums.lunatic.launcher.databinding.LauncherActivityBinding
import bums.lunatic.launcher.feeds.WidgetHost import bums.lunatic.launcher.feeds.WidgetHost
import bums.lunatic.launcher.helpers.BluetoothManager
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_APPLICATION_THEME
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_STATUS_BAR import bums.lunatic.launcher.helpers.Constants.Companion.KEY_STATUS_BAR
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import bums.lunatic.launcher.helpers.Constants.Companion.widgetHostId import bums.lunatic.launcher.helpers.Constants.Companion.widgetHostId
@ -81,13 +70,11 @@ import bums.lunatic.launcher.home.LauncherHome
import bums.lunatic.launcher.home.RssViewBuilder import bums.lunatic.launcher.home.RssViewBuilder
import bums.lunatic.launcher.model.RssData import bums.lunatic.launcher.model.RssData
import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.receiver.NLService
import bums.lunatic.launcher.tokiz.Comics import bums.lunatic.launcher.tokiz.Comics
import bums.lunatic.launcher.tokiz.Webtoons import bums.lunatic.launcher.tokiz.Webtoons
import bums.lunatic.launcher.utils.Blog import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.utils.FeedParseManager import bums.lunatic.launcher.utils.FeedParseManager
import bums.lunatic.launcher.utils.getJ import bums.lunatic.launcher.utils.getJ
import bums.lunatic.launcher.view.TableRadioGroup
import bums.lunatic.launcher.workers.AppInfoGetter import bums.lunatic.launcher.workers.AppInfoGetter
import bums.lunatic.launcher.workers.ArcaGetter import bums.lunatic.launcher.workers.ArcaGetter
import bums.lunatic.launcher.workers.CalendarGetter import bums.lunatic.launcher.workers.CalendarGetter
@ -97,11 +84,10 @@ import bums.lunatic.launcher.workers.DCGetter
import bums.lunatic.launcher.workers.DotaxGetter import bums.lunatic.launcher.workers.DotaxGetter
import bums.lunatic.launcher.workers.DotaxGetter.Companion.COMIC2_WORK_TAG import bums.lunatic.launcher.workers.DotaxGetter.Companion.COMIC2_WORK_TAG
import bums.lunatic.launcher.workers.FmKoreaGetter import bums.lunatic.launcher.workers.FmKoreaGetter
import bums.lunatic.launcher.workers.FmKoreaGetter.Companion.COMIC_WORK_TAG import bums.lunatic.launcher.workers.FmKoreaGetter.Companion.FM_WORK_TAG
import bums.lunatic.launcher.workers.LocationGetter import bums.lunatic.launcher.workers.LocationGetter
import bums.lunatic.launcher.workers.NewsFeedsGetter import bums.lunatic.launcher.workers.NewsFeedsGetter
import bums.lunatic.launcher.workers.NewsFeedsGetter.Companion.FEDDS_WORK_TAG import bums.lunatic.launcher.workers.NewsFeedsGetter.Companion.FEDDS_WORK_TAG
import bums.lunatic.launcher.workers.OpenWeatherGetter
import bums.lunatic.launcher.workers.RecentCallGetter import bums.lunatic.launcher.workers.RecentCallGetter
import bums.lunatic.launcher.workers.RecentSmsGetter import bums.lunatic.launcher.workers.RecentSmsGetter
import bums.lunatic.launcher.workers.RecentSmsGetter.Companion.SMS_WORK_TAG import bums.lunatic.launcher.workers.RecentSmsGetter.Companion.SMS_WORK_TAG
@ -202,7 +188,6 @@ internal class LauncherActivity : CommonActivity() {
.addTag(RuliWebGetter.TAG) .addTag(RuliWebGetter.TAG)
.build()) .build())
mWorkManager?.cancelAllWorkByTag(FEDDS_WORK_TAG) mWorkManager?.cancelAllWorkByTag(FEDDS_WORK_TAG)
mWorkManager?.enqueueUniquePeriodicWork( mWorkManager?.enqueueUniquePeriodicWork(
FEDDS_WORK_TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE, FEDDS_WORK_TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
@ -221,11 +206,11 @@ internal class LauncherActivity : CommonActivity() {
PeriodicWorkRequestBuilder<RedditGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES) PeriodicWorkRequestBuilder<RedditGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
.addTag(REDDIT_WORK_TAG) .addTag(REDDIT_WORK_TAG)
.build()) .build())
mWorkManager?.cancelAllWorkByTag(COMIC_WORK_TAG) mWorkManager?.cancelAllWorkByTag(FM_WORK_TAG)
mWorkManager?.enqueueUniquePeriodicWork( mWorkManager?.enqueueUniquePeriodicWork(
COMIC_WORK_TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE, FM_WORK_TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
PeriodicWorkRequestBuilder<FmKoreaGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES) PeriodicWorkRequestBuilder<FmKoreaGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
.addTag(COMIC_WORK_TAG) .addTag(FM_WORK_TAG)
.build()) .build())
mWorkManager?.cancelAllWorkByTag(COMIC2_WORK_TAG) mWorkManager?.cancelAllWorkByTag(COMIC2_WORK_TAG)
mWorkManager?.enqueueUniquePeriodicWork( mWorkManager?.enqueueUniquePeriodicWork(

View File

@ -31,7 +31,6 @@ import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.databinding.ListItemWithBinding import bums.lunatic.launcher.databinding.ListItemWithBinding
import bums.lunatic.launcher.home.adapters.RssItemDiffUtil import bums.lunatic.launcher.home.adapters.RssItemDiffUtil
import bums.lunatic.launcher.model.JGuru
import bums.lunatic.launcher.model.RssDataInterface import bums.lunatic.launcher.model.RssDataInterface
import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.RssDataType
import com.squareup.picasso.Picasso import com.squareup.picasso.Picasso
@ -95,16 +94,6 @@ internal class RssAdapter<T : RssDataInterface>(private val context: Context) :
} }
holder.view.root.setOnLongClickListener { holder.view.root.setOnLongClickListener {
if(item is JGuru) {
openOpera(
"https://cili.site/search?q=${
URLEncoder.encode(
item.model,
Charset.defaultCharset().name()
)
}"
)
}
openOpera(item.originPage()) openOpera(item.originPage())
true true
} }

View File

@ -0,0 +1,31 @@
//import androidx.annotation.Nullable;
//
//import java.util.HashMap;
//
import androidx.annotation.Nullable;
import java.util.HashMap;
////package bums.lunatic.launcher.home;
////
////import androidx.annotation.Nullable;
////
////import java.util.HashMap;
////
public class ExtHahMap extends HashMap<String,Object> {
@Nullable
@Override
public Object put(String key, Object value) {
if (value instanceof String) {
if (((String) value).length() > 0) {
} else {
}
}else {
return super.put(key, value);
}
}
}

View File

@ -19,6 +19,7 @@
package bums.lunatic.launcher.home package bums.lunatic.launcher.home
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context
import android.content.SharedPreferences import android.content.SharedPreferences
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
@ -201,7 +202,8 @@ internal class LauncherHome : Fragment() {
} }
} }
when(rss.category()) { when(rss.category()) {
RssDataType.GURU,RssDataType.MOST,RssDataType.REDDIT_NSFW -> { //RssDataType.GURU,RssDataType.MOST,
RssDataType.REDDIT_NSFW -> {
v.findViewById<ShapeableImageView>(R.id.circle_preview)?.let { v.findViewById<ShapeableImageView>(R.id.circle_preview)?.let {
if (it.visibility == View.GONE) { if (it.visibility == View.GONE) {
it.visibility = View.VISIBLE it.visibility = View.VISIBLE
@ -287,12 +289,15 @@ internal class LauncherHome : Fragment() {
} }
} }
} }
val nullCursor = PointerIcon.getSystemIcon(context!!, PointerIcon.TYPE_NULL) val nullCursor = PointerIcon.getSystemIcon(context!!, PointerIcon.TYPE_NULL)
binding.root.setPointerIcon(nullCursor) binding.root.setPointerIcon(nullCursor)
return binding.root return binding.root
} }
fun vote(){ fun vote(){
Blog.LOGE("Arrow Center Click") Blog.LOGE("Arrow Center Click")
WorkersDb.getRealm().apply { WorkersDb.getRealm().apply {
@ -369,7 +374,8 @@ internal class LauncherHome : Fragment() {
} }
fun queryInfos( fun queryInfos(
filter: Collection<RssDataType>? = arrayListOf(RssDataType.GURU, RssDataType.MOST,RssDataType.REDDIT_NSFW), noLimit: Boolean = false //RssDataType.GURU, RssDataType.MOST,
filter: Collection<RssDataType>? = arrayListOf(RssDataType.REDDIT_NSFW), noLimit: Boolean = false
) { ) {
beforeQuery() beforeQuery()
var rQ = WorkersDb.getRealm().query<RssData>().query("read < $0", nomoreShowCount).distinct("originPage", "title") var rQ = WorkersDb.getRealm().query<RssData>().query("read < $0", nomoreShowCount).distinct("originPage", "title")
@ -469,6 +475,8 @@ internal class LauncherHome : Fragment() {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
val nullCursor = PointerIcon.getSystemIcon(context!!, PointerIcon.TYPE_NULL)
binding.root.setPointerIcon(nullCursor)
if (shouldResume) { if (shouldResume) {
} }
@ -482,3 +490,5 @@ internal class LauncherHome : Fragment() {

View File

@ -1,125 +1,124 @@
/* ///*
* Lunar Launcher // * Lunar Launcher
* Copyright (C) 2022 Md Rasel Hossain // * Copyright (C) 2022 Md Rasel Hossain
* // *
* This program is free software: you can redistribute it and/or modify // * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by // * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or // * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. // * (at your option) any later version.
* // *
* This program is distributed in the hope that it will be useful, // * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of // * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. // * GNU General Public License for more details.
* // *
* You should have received a copy of the GNU General Public License // * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. // * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ // */
package bums.lunatic.launcher.home.adapters
import android.annotation.SuppressLint
import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.ListItemBinding
import bums.lunatic.launcher.model.jGuruTag
import com.google.gson.Gson
internal class RssTagAdapter(
private val smsList: ArrayList<jGuruTag>,
private val context: Context) : RecyclerView.Adapter<RssTagAdapter.RssTag>() {
private val currentFragment = lActivity!!.supportFragmentManager.findFragmentById(R.id.mainFragmentsContainer)
override fun onCreateViewHolder(viewGroup: ViewGroup, i: Int): RssTag {
val binding = ListItemBinding.inflate(LayoutInflater.from(viewGroup.context), viewGroup, false)
return RssTag(binding)
}
override fun getItemCount(): Int {
return smsList.size
}
@SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: RssTag, position: Int) {
val todo = smsList[position]
holder.view.itemText.text = "\u25CF ${Gson().toJson(todo)}"
/* multiline texts are enabled for TodoManager */
// holder.view.itemText.isSingleLine = false
/* launch edit or update dialog on item click */
// holder.view.itemText.setOnClickListener { updateDialog(position) }
/* copy texts on long click */
holder.view.itemText.setOnLongClickListener {
true
}
}
inner class RssTag(var view: ListItemBinding) : RecyclerView.ViewHolder(view.root)
fun updateData(newList: List<jGuruTag>) {
val diffUtilResult = DiffUtil.calculateDiff(RssTagDiffUtil(smsList, newList))
diffUtilResult.dispatchUpdatesTo(this)
// smsList.clear()
// smsList.addAll(newList)
}
/* update dialog */
private fun updateDialog(position: Int) {
// val bottomSheetDialog = BottomSheetDialog(lActivity!!, R.style.BottomSheetDialog)
// val dialogBinding = TodoDialogBinding.inflate(LayoutInflater.from(context))
// bottomSheetDialog.setContentView(dialogBinding.root)
// bottomSheetDialog.show()
// bottomSheetDialog.dismissWithAnimation = true
// //
// val databaseHandler = DatabaseHandler(context) //package bums.lunatic.launcher.home.adapters
// val todo = databaseHandler.todos[position]
// //
// dialogBinding.apply { //import android.annotation.SuppressLint
// deleteAllConfirmation.visibility = View.GONE //import android.content.Context
// todoInput.setText(todo.name) //import android.view.LayoutInflater
// todoCancel.text = context.getString(R.string.delete) //import android.view.ViewGroup
// todoCancel.setTextColor(ContextCompat.getColor(context, android.R.color.holo_red_light)) //import androidx.recyclerview.widget.DiffUtil
// todoOk.text = context.getString(R.string.update) //import androidx.recyclerview.widget.RecyclerView
//import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
//import bums.lunatic.launcher.R
//import bums.lunatic.launcher.databinding.ListItemBinding
//import com.google.gson.Gson
//
//internal class RssTagAdapter(
// private val smsList: ArrayList<jGuruTag>,
// private val context: Context) : RecyclerView.Adapter<RssTagAdapter.RssTag>() {
//
// private val currentFragment = lActivity!!.supportFragmentManager.findFragmentById(R.id.mainFragmentsContainer)
//
// override fun onCreateViewHolder(viewGroup: ViewGroup, i: Int): RssTag {
// val binding = ListItemBinding.inflate(LayoutInflater.from(viewGroup.context), viewGroup, false)
// return RssTag(binding)
// }
//
// override fun getItemCount(): Int {
// return smsList.size
// }
//
// @SuppressLint("SetTextI18n")
// override fun onBindViewHolder(holder: RssTag, position: Int) {
// val todo = smsList[position]
//
// holder.view.itemText.text = "\u25CF ${Gson().toJson(todo)}"
// /* multiline texts are enabled for TodoManager */
//// holder.view.itemText.isSingleLine = false
// /* launch edit or update dialog on item click */
//// holder.view.itemText.setOnClickListener { updateDialog(position) }
// /* copy texts on long click */
// holder.view.itemText.setOnLongClickListener {
//
// true
// } // }
// //
// /* delete the item */ // }
// dialogBinding.todoCancel.setOnClickListener {
// //
// } // inner class RssTag(var view: ListItemBinding) : RecyclerView.ViewHolder(view.root)
// //
// /* update the item */ // fun updateData(newList: List<jGuruTag>) {
// dialogBinding.todoOk.setOnClickListener { // val diffUtilResult = DiffUtil.calculateDiff(RssTagDiffUtil(smsList, newList))
// val updatedTodoString = Objects.requireNonNull(dialogBinding.todoInput.text).toString().trim { it <= ' ' } // diffUtilResult.dispatchUpdatesTo(this)
// if (updatedTodoString.isNotEmpty()) { //// smsList.clear()
// todo.name = updatedTodoString //// smsList.addAll(newList)
// databaseHandler.updateTodo(todo) // }
// bottomSheetDialog.dismiss() //
// } else { // /* update dialog */
// dialogBinding.todoInput.error = context.getString(R.string.empty_text_field) // private fun updateDialog(position: Int) {
// } //// val bottomSheetDialog = BottomSheetDialog(lActivity!!, R.style.BottomSheetDialog)
// } //// val dialogBinding = TodoDialogBinding.inflate(LayoutInflater.from(context))
} //// bottomSheetDialog.setContentView(dialogBinding.root)
//// bottomSheetDialog.show()
} //// bottomSheetDialog.dismissWithAnimation = true
////
internal class RssTagDiffUtil( //// val databaseHandler = DatabaseHandler(context)
private val oldList: List<jGuruTag>, private val newList: List<jGuruTag> //// val todo = databaseHandler.todos[position]
) : DiffUtil.Callback() { ////
//// dialogBinding.apply {
override fun getOldListSize(): Int = oldList.size //// deleteAllConfirmation.visibility = View.GONE
override fun getNewListSize(): Int = newList.size //// todoInput.setText(todo.name)
//// todoCancel.text = context.getString(R.string.delete)
override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean = //// todoCancel.setTextColor(ContextCompat.getColor(context, android.R.color.holo_red_light))
oldList[oldItemPosition].link == newList[newItemPosition].link //// todoOk.text = context.getString(R.string.update)
//// }
override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean = ////
oldList[oldItemPosition].link == newList[newItemPosition].link //// /* delete the item */
} //// dialogBinding.todoCancel.setOnClickListener {
////
//// }
////
//// /* update the item */
//// dialogBinding.todoOk.setOnClickListener {
//// val updatedTodoString = Objects.requireNonNull(dialogBinding.todoInput.text).toString().trim { it <= ' ' }
//// if (updatedTodoString.isNotEmpty()) {
//// todo.name = updatedTodoString
//// databaseHandler.updateTodo(todo)
//// bottomSheetDialog.dismiss()
//// } else {
//// dialogBinding.todoInput.error = context.getString(R.string.empty_text_field)
//// }
//// }
// }
//
//}
//
//internal class RssTagDiffUtil(
// private val oldList: List<jGuruTag>, private val newList: List<jGuruTag>
//) : DiffUtil.Callback() {
//
// override fun getOldListSize(): Int = oldList.size
// override fun getNewListSize(): Int = newList.size
//
// override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean =
// oldList[oldItemPosition].link == newList[newItemPosition].link
//
// override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean =
// oldList[oldItemPosition].link == newList[newItemPosition].link
//}

View File

@ -1,136 +1,136 @@
package bums.lunatic.launcher.model //package bums.lunatic.launcher.model
//
import bums.lunatic.launcher.utils.JamoUtils //import bums.lunatic.launcher.utils.JamoUtils
//
//
class MostItem : JGuru , RssDataInterface { //class MostItem : JGuru , RssDataInterface {
//
constructor() : super() // constructor() : super()
//
override fun title(): String { // override fun title(): String {
return title // return title
} // }
//
override fun thumbnailUrl(): String { // override fun thumbnailUrl(): String {
return image // return image
} // }
//
override fun originPage(): String { // override fun originPage(): String {
return pageLink // return pageLink
} // }
//
override fun description(): String { // override fun description(): String {
return tags.plus(", ").plus(model).plus(", ").plus(category()) // return tags.plus(", ").plus(model).plus(", ").plus(category())
} // }
//
override fun pubDate(): Long { // override fun pubDate(): Long {
return date // return date
} // }
//
override fun category(): RssDataType { // override fun category(): RssDataType {
return RssDataType.MOST // return RssDataType.MOST
} // }
//
override fun getCho(): String? { // override fun getCho(): String? {
return JamoUtils.split(title!!).joinToString("") // return JamoUtils.split(title!!).joinToString("")
} // }
} //}
open class JGuru : RssDataInterface { //open class JGuru : RssDataInterface {
var model : String = "" // var model : String = ""
var title : String = "" // var title : String = ""
var pageLink : String = "" // var pageLink : String = ""
var image : String = "" // var image : String = ""
var tags : String = "" // var tags : String = ""
var date : Long = 0L // var date : Long = 0L
//
constructor( // constructor(
model: String, // model: String,
title: String, // title: String,
pageLink: String, // pageLink: String,
image: String, // image: String,
tags: String, // tags: String,
date: Long // date: Long
) { // ) {
this.model = model // this.model = model
this.title = title // this.title = title
this.pageLink = pageLink // this.pageLink = pageLink
this.image = image // this.image = image
this.tags = tags // this.tags = tags
this.date = date // this.date = date
} // }
//
constructor() // constructor()
//
override fun title(): String { // override fun title(): String {
return title // return title
} // }
//
override fun thumbnailUrl(): String { // override fun thumbnailUrl(): String {
return image // return image
} // }
//
override fun originPage(): String { // override fun originPage(): String {
return pageLink // return pageLink
} // }
//
override fun description(): String { // override fun description(): String {
return tags.plus(", ").plus(model).plus(", ").plus(category()) // return tags.plus(", ").plus(model).plus(", ").plus(category())
} // }
//
override fun pubDate(): Long { // override fun pubDate(): Long {
return date // return date
} // }
//
override fun category(): RssDataType { // override fun category(): RssDataType {
return RssDataType.GURU // return RssDataType.GURU
} // }
//
fun isValid() = (((pageLink.length ?:0) > 0) && ((title.length ?:0) > 0)&& ((image.length ?:0) > 0)) // fun isValid() = (((pageLink.length ?:0) > 0) && ((title.length ?:0) > 0)&& ((image.length ?:0) > 0))
//
override fun getCho(): String? { // override fun getCho(): String? {
return JamoUtils.split(title!!).joinToString("") // return JamoUtils.split(title!!).joinToString("")
} // }
} //}
//
class jGuruTag : RssDataInterface { //class jGuruTag : RssDataInterface {
var link : String = "" // var link : String = ""
var tagTitle = "" // var tagTitle = ""
var count = 0 // var count = 0
//
override fun title(): String { // override fun title(): String {
return tagTitle // return tagTitle
} // }
//
override fun thumbnailUrl(): String { // override fun thumbnailUrl(): String {
return "" // return ""
} // }
//
override fun originPage(): String { // override fun originPage(): String {
return link // return link
} // }
//
override fun description(): String { // override fun description(): String {
return " " // return " "
} // }
//
override fun pubDate(): Long { // override fun pubDate(): Long {
return count.toLong() // return count.toLong()
} // }
//
override fun category(): RssDataType { // override fun category(): RssDataType {
return RssDataType.TAGS // return RssDataType.TAGS
} // }
//
constructor(link: String, tagTitle: String) { // constructor(link: String, tagTitle: String) {
this.link = link // this.link = link
this.tagTitle = tagTitle // this.tagTitle = tagTitle
if (tagTitle.contains("(") && tagTitle.contains(")")) { // if (tagTitle.contains("(") && tagTitle.contains(")")) {
try { // try {
count = tagTitle.split("(")[1].split(")")[0].toInt() // count = tagTitle.split("(")[1].split(")")[0].toInt()
}catch (e : Exception) {} // }catch (e : Exception) {}
} // }
} // }
override fun getCho(): String? { // override fun getCho(): String? {
return JamoUtils.split(tagTitle!!).joinToString("") // return JamoUtils.split(tagTitle!!).joinToString("")
} // }
} //}

View File

@ -8,8 +8,8 @@ enum class RssDataType {
NO_DATA, NO_DATA,
YOUTUBE, YOUTUBE,
NEWSFEED, NEWSFEED,
GURU, // GURU,
MOST, // MOST,
TAGS, TAGS,
REDDIT, REDDIT,
REDDIT_NSFW, REDDIT_NSFW,
@ -35,24 +35,28 @@ enum class RssDataType {
fun defaultImgSize() = when (this) { fun defaultImgSize() = when (this) {
YOUTUBE -> 200 YOUTUBE -> 200
REDDIT_NSFW,GURU,MOST -> 360 REDDIT_NSFW -> 360
//,GURU,MOST
else -> { 120 } else -> { 120 }
} }
fun getDefaultVisibiliy() = when (this) { fun getDefaultVisibiliy() = when (this) {
REDDIT_NSFW,GURU,MOST,NEWSFEED -> View.GONE //,GURU,MOST
REDDIT_NSFW,NEWSFEED -> View.GONE
else -> { View.VISIBLE } else -> { View.VISIBLE }
} }
fun isOn(block : ()->Unit) { fun isOn(block : ()->Unit) {
if(PrefHelper.getBoolean(name,false)) { block.invoke()
block.invoke() // if(PrefHelper.getBoolean(name,false)) {
} // block.invoke()
// }
} }
companion object { 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, ARCA).map { it.name }
fun getAdts() = arrayListOf( REDDIT_NSFW, MOST,GURU).map { it.name } fun getAdts() = arrayListOf( REDDIT_NSFW).map { it.name }
//, MOST,GURU
} }
} }

View File

@ -1,5 +1,6 @@
package bums.lunatic.launcher.tokiz package bums.lunatic.launcher.tokiz
import android.content.Context
import android.content.DialogInterface import android.content.DialogInterface
import android.content.Intent import android.content.Intent
import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo
@ -329,6 +330,7 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface {
return return
} }
binding.menuWeb.postDelayed({ binding.menuWeb.postDelayed({
Blog.LOGE("onPageStop $success from WebExtension ${mPort!!.name}") Blog.LOGE("onPageStop $success from WebExtension ${mPort!!.name}")
val message: JSONObject = JSONObject() val message: JSONObject = JSONObject()
try { try {
@ -340,6 +342,8 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface {
} }
mPort!!.postMessage(message) mPort!!.postMessage(message)
when(this@BaseToki) { when(this@BaseToki) {
is Comics , is Webtoons -> { is Comics , is Webtoons -> {
lastInfo lastInfo
@ -646,6 +650,8 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
val nullCursor = PointerIcon.getSystemIcon(context!!, PointerIcon.TYPE_NULL)
binding.root.setPointerIcon(nullCursor)
loadLastInfo() loadLastInfo()
} }
@ -702,6 +708,8 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface {
} }
} }
fun onBookInfos(jsonString: String) { fun onBookInfos(jsonString: String) {
Blog.LOGE("onBookInfos", "jsonString >> ${jsonString}") Blog.LOGE("onBookInfos", "jsonString >> ${jsonString}")
val realm = openRealm() val realm = openRealm()

View File

@ -1,7 +1,6 @@
package bums.lunatic.launcher.utils package bums.lunatic.launcher.utils
import bums.lunatic.launcher.home.LauncherHome.Companion.lastedFinishedPageUrl import bums.lunatic.launcher.home.LauncherHome.Companion.lastedFinishedPageUrl
import bums.lunatic.launcher.model.MostItem
import bums.lunatic.launcher.model.RssData import bums.lunatic.launcher.model.RssData
import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.dateFormat import bums.lunatic.launcher.model.dateFormat
@ -67,28 +66,28 @@ object QVZTb2dpcmw : SoInterface {
return String(Base64.getMimeDecoder().decode(this.javaClass.simpleName.plus("==").toByteArray())) return String(Base64.getMimeDecoder().decode(this.javaClass.simpleName.plus("==").toByteArray()))
} }
override fun parse(doc : Document, consoleLog : (String)-> Unit) { override fun parse(doc : Document, consoleLog : (String)-> Unit) {
doc.getElementsByTag("article").forEach { article -> // doc.getElementsByTag("article").forEach { article ->
consoleLog("ogirl article >>> ${article.text()}") // consoleLog("ogirl article >>> ${article.text()}")
val title = article.getElementsByTag("a").get(0).attr("title") // val title = article.getElementsByTag("a").get(0).attr("title")
val href = article.getElementsByTag("a").get(0).attr("href") // val href = article.getElementsByTag("a").get(0).attr("href")
val img = article.getElementsByTag("img").get(0).attr("data-src") // val img = article.getElementsByTag("img").get(0).attr("data-src")
WorkersDb.getRealm().writeBlocking { // WorkersDb.getRealm().writeBlocking {
if (query<RssData>("originPage == $0", href).find().size == 0) { // if (query<RssData>("originPage == $0", href).find().size == 0) {
RssData().apply { // RssData().apply {
this.originPage = href // this.originPage = href
this.title = title // this.title = title
this.description = "Sogirl" // this.description = "Sogirl"
this.thumbnail = img // this.thumbnail = img
this.pubDate = Date().time // this.pubDate = Date().time
this.category = RssDataType.GURU.name // this.category = RssDataType.GURU.name
this.chosung = // this.chosung =
JamoUtils.split(title).joinToString("") // JamoUtils.split(title).joinToString("")
copyToRealm(this) // copyToRealm(this)
} // }
consoleLog("title $title | href $href | img $img" ) // consoleLog("title $title | href $href | img $img" )
} // }
} // }
} // }
} }
} }
object SkFWTW9zdA : SoInterface { object SkFWTW9zdA : SoInterface {
@ -97,31 +96,31 @@ object SkFWTW9zdA : SoInterface {
return String(Base64.getMimeDecoder().decode(this.javaClass.simpleName.plus("==").toByteArray())) return String(Base64.getMimeDecoder().decode(this.javaClass.simpleName.plus("==").toByteArray()))
} }
override fun parse(doc: Document, consoleLog: (String) -> Unit) { override fun parse(doc: Document, consoleLog: (String) -> Unit) {
consoleLog("$lastedFinishedPageUrl >>> ${doc.title()}") // consoleLog("$lastedFinishedPageUrl >>> ${doc.title()}")
doc.getElementsByClass("card").forEach { card -> // doc.getElementsByClass("card").forEach { card ->
var thumb = if(card.getElementsByTag("img").size > 0) card.getElementsByTag("img").get(0).attr("src") else "" // 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 // if (thumb.contains("No+Poster")) thumb = if(card.getElementsByTag("img").size > 0) card.getElementsByTag("img").get(0).attr("data-src") else thumb
var model = if(card.getElementsByTag("img").size > 0) card.getElementsByTag("img").get(0).attr("alt") else "" // var model = if(card.getElementsByTag("img").size > 0) card.getElementsByTag("img").get(0).attr("alt") else ""
if(card.getElementsByClass("card-block").size > 0) if(card.getElementsByClass("card-block").size > 0) { // if(card.getElementsByClass("card-block").size > 0) if(card.getElementsByClass("card-block").size > 0) {
val link = card.getElementsByClass("card-block").get(0).getElementsByTag("a").get(0).attr("href") // val link = card.getElementsByClass("card-block").get(0).getElementsByTag("a").get(0).attr("href")
val title = card.getElementsByClass("card-block").get(0).getElementsByTag("a").get(0).attr("title") // val title = card.getElementsByClass("card-block").get(0).getElementsByTag("a").get(0).attr("title")
val date = card.getElementsByTag("span").get(0).text() // val date = card.getElementsByTag("span").get(0).text()
MostItem().let { ms -> // MostItem().let { ms ->
ms.model = model // ms.model = model
ms.image = thumb // ms.image = thumb
ms.pageLink = link // ms.pageLink = link
ms.title = title // ms.title = title
try { // try {
ms.date = dmy.parse(date).time // ms.date = dmy.parse(date).time
consoleLog("dateFormat.format(Date(ms.date)) ${dateFormat.format(Date(ms.date))}") // consoleLog("dateFormat.format(Date(ms.date)) ${dateFormat.format(Date(ms.date))}")
}catch (e : Exception) {e.printStackTrace()} // }catch (e : Exception) {e.printStackTrace()}
if (ms.isValid()) { // if (ms.isValid()) {
WorkersDb.insertData(ms.getRssData()) // WorkersDb.insertData(ms.getRssData())
} // }
} // }
consoleLog(" model >>>>> ${model}\n | thumb >>>>> ${thumb}\n | title >>>>> ${title}\n | date >>>>> ${date} | ") // consoleLog(" model >>>>> ${model}\n | thumb >>>>> ${thumb}\n | title >>>>> ${title}\n | date >>>>> ${date} | ")
} // }
} // }
consoleLog("excuted j req() ${WorkersDb.getRealm().query<RssData>("category == $0", RssDataType.GURU.name).find().size}") // consoleLog("excuted j req() ${WorkersDb.getRealm().query<RssData>("category == $0", RssDataType.GURU.name).find().size}")
} }
} }

View File

@ -7,6 +7,7 @@ import bums.lunatic.launcher.model.RssDataInterface
import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.getRssData import bums.lunatic.launcher.model.getRssData
import bums.lunatic.launcher.model.getT import bums.lunatic.launcher.model.getT
import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.utils.beforeOneDay import bums.lunatic.launcher.utils.beforeOneDay
//import bums.lunatic.launcher.workers.WorkersDb.blockKeyword //import bums.lunatic.launcher.workers.WorkersDb.blockKeyword
import org.jsoup.Jsoup import org.jsoup.Jsoup
@ -23,6 +24,7 @@ class ArcaGetter : BaseGetter {
override fun realWork(): Result { override fun realWork(): Result {
RssDataType.ARCA.isOn { RssDataType.ARCA.isOn {
try { try {
Blog.LOGE("realWork() ${this::class.simpleName}")
temp.clear() temp.clear()
val urls = arrayListOf( val urls = arrayListOf(
"https://arca.live/b/singbung?mode=best", "https://arca.live/b/singbung?mode=best",
@ -34,22 +36,33 @@ class ArcaGetter : BaseGetter {
// "https://arca.live/b/breaking" // "https://arca.live/b/breaking"
) )
urls.forEach { urls.forEach {
Jsoup.connect(it) try {
.userAgent(USAGT) Jsoup.connect(it)
.get().let { arca -> .userAgent(USAGT)
.header("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8")
.header("accept-language", "ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7")
.header("cache-control", "no-cache")
.header("pragma", "no-cache")
.ignoreContentType(true)
.timeout(5000)
.get().let { arca ->
// BLog.LOGE("url >> ${it} >> ${arca}") // BLog.LOGE("url >> ${it} >> ${arca}")
arca.getElementsByClass("vrow hybrid").forEach { araca_li -> arca.getElementsByClass("vrow hybrid").forEach { araca_li ->
if (araca_li.html().contains("title ") == true) { if (araca_li.html().contains("title ") == true) {
parseArcaLi(araca_li).apply { parseArcaLi(araca_li).apply {
this.forEach { this.forEach {
if (it.pubDate() > commicsDateTime) { if (it.pubDate() > commicsDateTime) {
temp.add(it.getRssData()) temp.add(it.getRssData())
}
} }
} }
} }
} }
} }
} } catch (e : Exception) {
e.printStackTrace()
}
} }
// Jsoup.connect("https://projrctjav.com").userAgent(USAGT).get().let { projectj -> // Jsoup.connect("https://projrctjav.com").userAgent(USAGT).get().let { projectj ->
// BLog.LOGE("projectj >>>>> ${projectj}") // BLog.LOGE("projectj >>>>> ${projectj}")

View File

@ -22,7 +22,7 @@ open abstract class BaseGetter : Worker {
} }
} }
val USAGT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.15" val USAGT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
val limitDateTime = beforeOneDay() val limitDateTime = beforeOneDay()
val commicsDateTime = beforeDay(1) val commicsDateTime = beforeDay(1)

View File

@ -8,6 +8,7 @@ import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.getHref import bums.lunatic.launcher.model.getHref
import bums.lunatic.launcher.model.getRssData import bums.lunatic.launcher.model.getRssData
import bums.lunatic.launcher.model.getT import bums.lunatic.launcher.model.getT
import bums.lunatic.launcher.utils.Blog
import org.jsoup.Jsoup import org.jsoup.Jsoup
class ClienGetter : BaseGetter { class ClienGetter : BaseGetter {
@ -71,6 +72,7 @@ class ClienGetter : BaseGetter {
@SuppressLint("RestrictedApi") @SuppressLint("RestrictedApi")
override fun realWork(): Result { override fun realWork(): Result {
RssDataType.CLIEN.isOn { RssDataType.CLIEN.isOn {
Blog.LOGE("realWork() ${this::class.simpleName}")
try { try {
temp.clear() temp.clear()
val testUrl2 = arrayListOf("https://www.clien.net/service/group/community","https://www.clien.net/service/board/park","https://www.clien.net/service/board/news","https://www.clien.net/service/board/useful","https://www.clien.net/service/board/pds") val testUrl2 = arrayListOf("https://www.clien.net/service/group/community","https://www.clien.net/service/board/park","https://www.clien.net/service/board/news","https://www.clien.net/service/board/useful","https://www.clien.net/service/board/pds")

View File

@ -8,6 +8,7 @@ import bums.lunatic.launcher.model.DcInside
import bums.lunatic.launcher.model.RssDataInterface import bums.lunatic.launcher.model.RssDataInterface
import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.getRssData import bums.lunatic.launcher.model.getRssData
import bums.lunatic.launcher.utils.Blog
import org.jsoup.Jsoup import org.jsoup.Jsoup
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
@ -73,6 +74,7 @@ class DCGetter : BaseGetter {
override fun realWork(): Result { override fun realWork(): Result {
// Blog.LOGE("${TAG} RssDataType.DCINSIDE.isOn >>>> ${PrefHelper.getBoolean(RssDataType.DCINSIDE.name,false)}") // Blog.LOGE("${TAG} RssDataType.DCINSIDE.isOn >>>> ${PrefHelper.getBoolean(RssDataType.DCINSIDE.name,false)}")
RssDataType.DCINSIDE.isOn { RssDataType.DCINSIDE.isOn {
Blog.LOGE("realWork() ${this::class.simpleName}")
temp.clear() temp.clear()
// https://m.dcinside.com/board/singlebungle1472 // https://m.dcinside.com/board/singlebungle1472
var urls = arrayListOf( var urls = arrayListOf(

View File

@ -6,6 +6,7 @@ import androidx.work.WorkerParameters
import bums.lunatic.launcher.model.Dotax import bums.lunatic.launcher.model.Dotax
import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.getRssData import bums.lunatic.launcher.model.getRssData
import bums.lunatic.launcher.utils.Blog
import org.jsoup.Jsoup import org.jsoup.Jsoup
class DotaxGetter : BaseGetter { class DotaxGetter : BaseGetter {
@ -20,6 +21,7 @@ class DotaxGetter : BaseGetter {
override fun realWork(): Result { override fun realWork(): Result {
RssDataType.DOTAX.isOn { RssDataType.DOTAX.isOn {
try { try {
Blog.LOGE("realWork() ${this::class.simpleName}")
temp.clear() temp.clear()
val dotaxUrls = arrayListOf("https://m.cafe.daum.net/dotax", val dotaxUrls = arrayListOf("https://m.cafe.daum.net/dotax",
"https://m.cafe.daum.net/dotax/_rec?page=2", "https://m.cafe.daum.net/dotax/_rec?page=2",
@ -28,6 +30,7 @@ class DotaxGetter : BaseGetter {
dotaxUrls?.forEach { dotaxUrls?.forEach {
Jsoup.connect(it).userAgent(USAGT).get()?.let { dotax -> Jsoup.connect(it).userAgent(USAGT).get()?.let { dotax ->
dotax.getElementsByTag("li").forEach { dotax_li -> dotax.getElementsByTag("li").forEach { dotax_li ->
Blog.LOGE("dotax_li >>> ${dotax_li.text()}")
if (dotax_li.getElementsByTag("a").size > 0 && dotax_li.getElementsByClass("board_name") if (dotax_li.getElementsByTag("a").size > 0 && dotax_li.getElementsByClass("board_name")
.html().contains("웃긴") .html().contains("웃긴")
) { ) {

View File

@ -6,12 +6,13 @@ import androidx.work.WorkerParameters
import bums.lunatic.launcher.model.FmKorea import bums.lunatic.launcher.model.FmKorea
import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.getRssData import bums.lunatic.launcher.model.getRssData
import bums.lunatic.launcher.utils.Blog
import org.jsoup.Jsoup import org.jsoup.Jsoup
import java.util.Date import java.util.Date
class FmKoreaGetter : BaseGetter { class FmKoreaGetter : BaseGetter {
companion object { companion object {
val COMIC_WORK_TAG = "ComicGetter" val FM_WORK_TAG = "FmKoreaGetter"
} }
constructor(context: Context, workerParams: WorkerParameters) : super(context, workerParams) { constructor(context: Context, workerParams: WorkerParameters) : super(context, workerParams) {
@ -36,6 +37,7 @@ class FmKoreaGetter : BaseGetter {
RssDataType.FMKORAE.isOn { RssDataType.FMKORAE.isOn {
val now = Date() val now = Date()
try { try {
Blog.LOGE("realWork() ${this::class.simpleName}")
val fmkoreaUrls = arrayListOf("https://m.fmkorea.com","https://m.fmkorea.com/best","https://m.fmkorea.com/best2") val fmkoreaUrls = arrayListOf("https://m.fmkorea.com","https://m.fmkorea.com/best","https://m.fmkorea.com/best2")
fmkoreaUrls.forEach { fmkoreaUrls.forEach {
try { try {

View File

@ -7,6 +7,7 @@ import androidx.work.WorkerParameters
import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.RuliWeb import bums.lunatic.launcher.model.RuliWeb
import bums.lunatic.launcher.model.getRssData import bums.lunatic.launcher.model.getRssData
import bums.lunatic.launcher.utils.Blog
import org.jsoup.Jsoup import org.jsoup.Jsoup
class RuliWebGetter : BaseGetter { class RuliWebGetter : BaseGetter {
@ -17,6 +18,7 @@ class RuliWebGetter : BaseGetter {
} }
fun parseRuli(ruli_tr : org.jsoup.nodes.Element) { fun parseRuli(ruli_tr : org.jsoup.nodes.Element) {
Blog.LOGE("ruli_tr >>> ${ruli_tr.text()}")
var aTags = ruli_tr.getElementsByTag("a") var aTags = ruli_tr.getElementsByTag("a")
var tagIdx = 0 var tagIdx = 0
var pageLink = "" var pageLink = ""
@ -62,13 +64,19 @@ class RuliWebGetter : BaseGetter {
override fun realWork(): Result { override fun realWork(): Result {
RssDataType.RULIWEB.isOn { RssDataType.RULIWEB.isOn {
try { 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","https://bbs.ruliweb.com/best/humor_only/now?m=humor_only&t=default&page=2")
testUrl2.forEach { url -> testUrl2.forEach { url ->
Jsoup.connect(url).timeout(5000).ignoreHttpErrors(true) Jsoup.connect(url).timeout(5000).ignoreHttpErrors(true)
.userAgent(USAGT) .userAgent(USAGT)
.header("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8")
.header("accept-language", "ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7")
.header("cache-control", "no-cache")
.header("pragma", "no-cache")
.ignoreContentType(true)
.get().let { ruli -> .get().let { ruli ->
// Blog.LOGE(TAG.plus("test ${testUrl2} >> ${ruli.title()}")) // Blog.LOGE(TAG.plus("test ${testUrl2} >> ${ruli.title()}"))
ruli.getElementsByTag("tr").forEach { ruli_tr -> ruli.getElementsByClass("table_body blocktarget").forEach { ruli_tr ->
parseRuli(ruli_tr) parseRuli(ruli_tr)
} }
} }