Skip to content

Commit

Permalink
lv0.24.2.6 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
XilinJia committed Aug 30, 2024
1 parent b3b5017 commit 4a1093d
Show file tree
Hide file tree
Showing 58 changed files with 300 additions and 1,000 deletions.
5 changes: 1 addition & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ allprojects {
compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'

version 'lv0.24.2.5'
version 'lv0.24.2.6'
group 'com.github.XilinJia'

repositories {
Expand All @@ -19,9 +19,6 @@ allprojects {
mavenJava(MavenPublication) {
from components.java
}
// groupId='com.github.XilinJia'
// artifactId = 'vistaguide'
// version = '1.0'
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions extractor/src/main/kotlin/ac/mdiq/vista/extractor/Image.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import java.util.*
*
*/
class Image(

/**
* Get the URL of this [Image].
* @return the [Image]'s URL.
Expand Down Expand Up @@ -118,7 +117,6 @@ class Image(
* @return the [ResolutionLevel] corresponding to the height provided. See the
* [ResolutionLevel] values for details about what value is returned.
*/

fun fromHeight(heightPx: Int): ResolutionLevel {
if (heightPx <= 0) return UNKNOWN
if (heightPx < 175) return LOW
Expand Down
16 changes: 4 additions & 12 deletions extractor/src/main/kotlin/ac/mdiq/vista/extractor/Info.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,8 @@ abstract class Info(

val service: StreamingService
get() {
try {
return Vista.getService(serviceId)
} catch (e: ExtractionException) {
// this should be unreachable, as serviceId certainly refers to a valid service
throw RuntimeException("Info object has invalid service id", e)
}
// the exception should be unreachable, as serviceId certainly refers to a valid service
try { return Vista.getService(serviceId) } catch (e: ExtractionException) { throw RuntimeException("Info object has invalid service id", e) }
}

fun addError(throwable: Throwable) {
Expand All @@ -47,15 +43,11 @@ abstract class Info(
errors.addAll(throwables!!)
}

constructor(serviceId: Int, linkHandler: LinkHandler, name: String) : this(serviceId,
linkHandler.id,
linkHandler.url,
linkHandler.originalUrl,
name)
constructor(serviceId: Int, linkHandler: LinkHandler, name: String)
: this(serviceId, linkHandler.id, linkHandler.url, linkHandler.originalUrl, name)

override fun toString(): String {
val ifDifferentString = if (url == originalUrl) "" else " (originalUrl=\"$originalUrl\")"
return ("${javaClass.simpleName}[url=\"$url\"$ifDifferentString, name=\"$name\"]")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ abstract class InfoItemsCollector<I : InfoItem, E : InfoItemExtractor>
}

override fun commit(extractor: E) {
try {
addItem(extract(extractor))
} catch (ae: FoundAdException) {
// found an ad. Maybe a debug line could be placed here
} catch (e: ParsingException) {
addError(e)
}
try { addItem(extract(extractor)) } catch (ae: FoundAdException) {/* found an ad. Maybe a debug line could be placed here */ } catch (e: ParsingException) { addError(e) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ abstract class ListInfo<T : InfoItem> : Info {
val contentFilters: List<String>
val sortFilter: String

constructor(serviceId: Int,
id: String,
url: String,
originalUrl: String,
name: String,
contentFilter: List<String>,
sortFilter: String)
constructor(serviceId: Int, id: String, url: String, originalUrl: String, name: String, contentFilter: List<String>, sortFilter: String)
: super(serviceId, id, url, originalUrl, name) {
this.contentFilters = contentFilter
this.sortFilter = sortFilter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ class MetaInfo : Serializable {

private var urlTexts: MutableList<String> = ArrayList()

constructor(title: String,
content: Description,
urls: MutableList<URL>,
urlTexts: MutableList<String>) {
constructor(title: String, content: Description, urls: MutableList<URL>, urlTexts: MutableList<String>) {
this.title = title
this.content = content
this.urls = urls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,72 +77,17 @@ class ChannelInfo(
val name = extractor.getName()

val info = ChannelInfo(serviceId, id, url, originalUrl, name)

try {
info.avatars = extractor.getAvatars()
} catch (e: Exception) {
info.addError(e)
}

try {
info.banners = extractor.getBanners()
} catch (e: Exception) {
info.addError(e)
}

try {
info.feedUrl = extractor.getFeedUrl()
} catch (e: Exception) {
info.addError(e)
}

try {
info.subscriberCount = extractor.getSubscriberCount()
} catch (e: Exception) {
info.addError(e)
}

try {
info.description = extractor.getDescription()
} catch (e: Exception) {
info.addError(e)
}

try {
info.parentChannelName = extractor.getParentChannelName()
} catch (e: Exception) {
info.addError(e)
}

try {
info.parentChannelUrl = extractor.getParentChannelUrl()
} catch (e: Exception) {
info.addError(e)
}

try {
info.parentChannelAvatars = extractor.getParentChannelAvatars()
} catch (e: Exception) {
info.addError(e)
}

try {
info.isVerified = extractor.isVerified()
} catch (e: Exception) {
info.addError(e)
}

try {
info.tabs = extractor.getTabs()
} catch (e: Exception) {
info.addError(e)
}

try {
info.tags = extractor.getTags()
} catch (e: Exception) {
info.addError(e)
}
try { info.avatars = extractor.getAvatars() } catch (e: Exception) { info.addError(e) }
try { info.banners = extractor.getBanners() } catch (e: Exception) { info.addError(e) }
try { info.feedUrl = extractor.getFeedUrl() } catch (e: Exception) { info.addError(e) }
try { info.subscriberCount = extractor.getSubscriberCount() } catch (e: Exception) { info.addError(e) }
try { info.description = extractor.getDescription() } catch (e: Exception) { info.addError(e) }
try { info.parentChannelName = extractor.getParentChannelName() } catch (e: Exception) { info.addError(e) }
try { info.parentChannelUrl = extractor.getParentChannelUrl() } catch (e: Exception) { info.addError(e) }
try { info.parentChannelAvatars = extractor.getParentChannelAvatars() } catch (e: Exception) { info.addError(e) }
try { info.isVerified = extractor.isVerified() } catch (e: Exception) { info.addError(e) }
try { info.tabs = extractor.getTabs() } catch (e: Exception) { info.addError(e) }
try { info.tags = extractor.getTags() } catch (e: Exception) { info.addError(e) }

return info
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,11 @@ class ChannelInfoItemsCollector(serviceId: Int) : InfoItemsCollector<ChannelInfo
val resultItem = ChannelInfoItem(serviceId, extractor.url, extractor.name?:"")

// optional information
try {
resultItem.subscriberCount = extractor.getSubscriberCount()
} catch (e: Exception) {
addError(e)
}
try {
resultItem.streamCount = extractor.getStreamCount()
} catch (e: Exception) {
addError(e)
}
try {
resultItem.thumbnails = (extractor.thumbnails)
} catch (e: Exception) {
addError(e)
}
try {
resultItem.description = extractor.getDescription()
} catch (e: Exception) {
addError(e)
}
try {
resultItem.isVerified = extractor.isVerified()
} catch (e: Exception) {
addError(e)
}
try { resultItem.subscriberCount = extractor.getSubscriberCount() } catch (e: Exception) { addError(e) }
try { resultItem.streamCount = extractor.getStreamCount() } catch (e: Exception) { addError(e) }
try { resultItem.thumbnails = (extractor.thumbnails) } catch (e: Exception) { addError(e) }
try { resultItem.description = extractor.getDescription() } catch (e: Exception) { addError(e) }
try { resultItem.isVerified = extractor.isVerified() } catch (e: Exception) { addError(e) }

return resultItem
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ class ChannelTabInfo(serviceId: Int, linkHandler: ListLinkHandler) : ListInfo<In
fun getInfo(extractor: ChannelTabExtractor): ChannelTabInfo {
val info = ChannelTabInfo(extractor.serviceId, extractor.getLinkHandler())

try {
info.originalUrl = extractor.originalUrl
} catch (e: Exception) {
info.addError(e)
}
try { info.originalUrl = extractor.originalUrl } catch (e: Exception) { info.addError(e) }

val page = ExtractorHelper.getItemsPageOrLogError(info, extractor)
info.relatedItems = (page.items)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ class CommentsInfo private constructor(
val initialCommentsPage = ExtractorHelper.getItemsPageOrLogError(commentsInfo, commentsExtractor)
commentsInfo.isCommentsDisabled = commentsExtractor.isCommentsDisabled
commentsInfo.relatedItems = initialCommentsPage.items
try {
commentsInfo.commentsCount = commentsExtractor.commentsCount
} catch (e: Exception) {
commentsInfo.addError(e)
}
try { commentsInfo.commentsCount = commentsExtractor.commentsCount } catch (e: Exception) { commentsInfo.addError(e) }
commentsInfo.nextPage = initialCommentsPage.nextPage

return commentsInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,110 +9,29 @@ class CommentsInfoItemsCollector(serviceId: Int) : InfoItemsCollector<CommentsIn
val resultItem = CommentsInfoItem(serviceId, extractor.url, extractor.name)

// optional information
try {
resultItem.commentId = extractor.commentId
} catch (e: Exception) {
addError(e)
}
try {
resultItem.commentText = extractor.commentText
} catch (e: Exception) {
addError(e)
}
try {
resultItem.uploaderName = extractor.uploaderName
} catch (e: Exception) {
addError(e)
}
try {
resultItem.uploaderAvatars = (extractor.uploaderAvatars)
} catch (e: Exception) {
addError(e)
}
try {
resultItem.uploaderUrl = extractor.uploaderUrl
} catch (e: Exception) {
addError(e)
}
try {
resultItem.textualUploadDate = extractor.textualUploadDate
} catch (e: Exception) {
addError(e)
}
try {
resultItem.uploadDate = extractor.uploadDate
} catch (e: Exception) {
addError(e)
}
try {
resultItem.likeCount = extractor.likeCount
} catch (e: Exception) {
addError(e)
}
try {
resultItem.textualLikeCount = extractor.textualLikeCount
} catch (e: Exception) {
addError(e)
}
try {
resultItem.thumbnails = (extractor.thumbnails)
} catch (e: Exception) {
addError(e)
}

try {
resultItem.isHeartedByUploader = extractor.isHeartedByUploader
} catch (e: Exception) {
addError(e)
}

try {
resultItem.isPinned = extractor.isPinned
} catch (e: Exception) {
addError(e)
}

try {
resultItem.streamPosition = extractor.streamPosition
} catch (e: Exception) {
addError(e)
}

try {
resultItem.replyCount = extractor.replyCount
} catch (e: Exception) {
addError(e)
}

try {
resultItem.replies = extractor.replies
} catch (e: Exception) {
addError(e)
}

try {
resultItem.isChannelOwner = extractor.isChannelOwner
} catch (e: Exception) {
addError(e)
}


try {
resultItem.setCreatorReply(extractor.hasCreatorReply())
} catch (e: Exception) {
addError(e)
}

try { resultItem.commentId = extractor.commentId } catch (e: Exception) { addError(e) }
try { resultItem.commentText = extractor.commentText } catch (e: Exception) { addError(e) }
try { resultItem.uploaderName = extractor.uploaderName } catch (e: Exception) { addError(e) }
try { resultItem.uploaderAvatars = (extractor.uploaderAvatars) } catch (e: Exception) { addError(e) }
try { resultItem.uploaderUrl = extractor.uploaderUrl } catch (e: Exception) { addError(e) }
try { resultItem.textualUploadDate = extractor.textualUploadDate } catch (e: Exception) { addError(e) }
try { resultItem.uploadDate = extractor.uploadDate } catch (e: Exception) { addError(e) }
try { resultItem.likeCount = extractor.likeCount } catch (e: Exception) { addError(e) }
try { resultItem.textualLikeCount = extractor.textualLikeCount } catch (e: Exception) { addError(e) }
try { resultItem.thumbnails = (extractor.thumbnails) } catch (e: Exception) { addError(e) }
try { resultItem.isHeartedByUploader = extractor.isHeartedByUploader } catch (e: Exception) { addError(e) }
try { resultItem.isPinned = extractor.isPinned } catch (e: Exception) { addError(e) }
try { resultItem.streamPosition = extractor.streamPosition } catch (e: Exception) { addError(e) }
try { resultItem.replyCount = extractor.replyCount } catch (e: Exception) { addError(e) }
try { resultItem.replies = extractor.replies } catch (e: Exception) { addError(e) }
try { resultItem.isChannelOwner = extractor.isChannelOwner } catch (e: Exception) { addError(e) }
try { resultItem.setCreatorReply(extractor.hasCreatorReply()) } catch (e: Exception) { addError(e) }

return resultItem
}

override fun commit(extractor: CommentsInfoItemExtractor) {
try {
addItem(extract(extractor))
} catch (e: Exception) {
addError(e)
}
try { addItem(extract(extractor)) } catch (e: Exception) { addError(e) }
}

val commentsInfoItemList: List<CommentsInfoItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ open class LinkHandler(
@JvmField val url: String,
@JvmField val id: String) : Serializable {

constructor(handler: LinkHandler) : this(handler.originalUrl, handler.url, handler.id)

@get:Throws(ParsingException::class)
val baseUrl: String
get() = getBaseUrl(url)

constructor(handler: LinkHandler) : this(handler.originalUrl, handler.url, handler.id)
}
Loading

0 comments on commit 4a1093d

Please sign in to comment.