@@ -282,9 +282,9 @@ object Parser {
282282
283283 var likeStatus = parseBody.selectFirst(" [name=like-status]" )
284284 ?.attr(" value" )
285- Log .i(" likeStatus" ,likeStatus.toString())
286- if (! likeStatus.isNullOrEmpty()){
287- likeStatus= " 1"
285+ Log .i(" likeStatus" , likeStatus.toString())
286+ if (! likeStatus.isNullOrEmpty()) {
287+ likeStatus = " 1"
288288 }
289289 val likesCount = parseBody.selectFirst(" input[name=likes-count]" )
290290 ?.attr(" value" )?.toIntOrNull()
@@ -310,7 +310,7 @@ object Parser {
310310 tagListWithLikeNum.add(child.text())
311311 }
312312 }
313- val tagList= tagListWithLikeNum.map { it.substringBefore(" (" ) }
313+ val tagList = tagListWithLikeNum.map { it.substringBefore(" (" ) }
314314 val myListCheckboxWrapper = parseBody.select(" div[class~=playlist-checkbox-wrapper]" )
315315 val myListInfo = mutableListOf<HanimeVideo .MyList .MyListInfo >()
316316 myListCheckboxWrapper.forEach {
@@ -336,7 +336,7 @@ object Parser {
336336 val playlistName = it.selectFirst(" div > div > h4" )?.text()
337337 val playlistScroll = it.getElementById(" playlist-scroll" )
338338 playlistScroll?.children()?.forEach { parent ->
339- if (parent.tagName()== " a" ){
339+ if (parent.tagName() == " a" ) {
340340 return @forEach
341341 }
342342// println("S------------------------------------S")
@@ -388,27 +388,25 @@ object Parser {
388388 ?.getElementsByClass(" home-rows-videos-div" )
389389 ?.firstOrNull() != null
390390 if (isSimplified) {
391- if (children != null ) {
392- for (each in children) {
393- val eachContent = each.selectFirst(" a" )
394- val homeRowsVideosDiv =
395- eachContent?.getElementsByClass(" home-rows-videos-div" )?.firstOrNull()
396-
397- if (homeRowsVideosDiv != null ) {
398- val eachVideoCode = eachContent.absUrl(" href" ).toVideoCode() ? : continue
399- val eachCoverUrl = homeRowsVideosDiv.selectFirst(" img" )?.absUrl(" src" )
400- .throwIfParseNull(Parser ::hanimeVideoVer2.name, " eachCoverUrl" )
401- val eachTitle =
402- homeRowsVideosDiv.selectFirst(" div[class$=title]" )?.text()
403- .throwIfParseNull(Parser ::hanimeVideoVer2.name, " eachTitle" )
404- relatedAnimeList.add(
405- HanimeInfo (
406- title = eachTitle, coverUrl = eachCoverUrl,
407- videoCode = eachVideoCode,
408- itemType = HanimeInfo .SIMPLIFIED
409- )
391+ for (each in children) {
392+ val eachContent = each.selectFirst(" a" )
393+ val homeRowsVideosDiv =
394+ eachContent?.getElementsByClass(" home-rows-videos-div" )?.firstOrNull()
395+
396+ if (homeRowsVideosDiv != null ) {
397+ val eachVideoCode = eachContent.absUrl(" href" ).toVideoCode() ? : continue
398+ val eachCoverUrl = homeRowsVideosDiv.selectFirst(" img" )?.absUrl(" src" )
399+ .throwIfParseNull(Parser ::hanimeVideoVer2.name, " eachCoverUrl" )
400+ val eachTitle =
401+ homeRowsVideosDiv.selectFirst(" div[class$=title]" )?.text()
402+ .throwIfParseNull(Parser ::hanimeVideoVer2.name, " eachTitle" )
403+ relatedAnimeList.add(
404+ HanimeInfo (
405+ title = eachTitle, coverUrl = eachCoverUrl,
406+ videoCode = eachVideoCode,
407+ itemType = HanimeInfo .SIMPLIFIED
410408 )
411- }
409+ )
412410 }
413411 }
414412 } else {
@@ -464,7 +462,7 @@ object Parser {
464462 )
465463 } else null
466464 }
467- val artist = if (artistAvatarUrl != null && artistName != null && artistGenre != null ) {
465+ val artist = if (artistName != null && artistGenre != null ) {
468466 HanimeVideo .Artist (
469467 name = artistName,
470468 avatarUrl = artistAvatarUrl,
@@ -713,7 +711,7 @@ object Parser {
713711
714712 buildList {
715713 allCommentsClass?.children()?.chunked(5 )?.forEach { elements ->
716- this + = Element (" div" ).apply { appendChildren(elements) }
714+ add( Element (" div" ).apply { appendChildren(elements) })
717715 }
718716 }.forEach { child: Element ->
719717 val avatarUrl = child.selectFirst(" img" )?.absUrl(" src" )
@@ -878,38 +876,41 @@ object Parser {
878876 artistName = artistName,
879877 avatar = avatarSrc
880878 )
881- } catch (e : Exception ) {
879+ } catch (_ : Exception ) {
882880 null
883881 }
884882 }
885883
886884 // 解析订阅视频
887885 val videos = subscriptionsVideosRoot.select(" div.col-xs-12.search-doujin-videos" )
888886 .mapNotNull { videoCard ->
889- try {
890- val link = videoCard.selectFirst(" a.overlay" )?.absUrl(" href" ) ? : return @mapNotNull null
891- val videoCode = Regex (""" watch\?v=(\d+)""" ).find(link)?.groupValues?.get(1 ) ? : return @mapNotNull null
892- val imgs = videoCard.select(" img" )
893- val coverUrl = imgs.getOrNull(1 )?.absUrl(" src" ) ? : return @mapNotNull null
894- val title = videoCard.selectFirst(" div.card-mobile-title" )?.text()?.trim() ? : return @mapNotNull null
895- val duration = videoCard.selectFirst(" div.card-mobile-duration" )?.text()?.trim()
896- val infoBoxes = videoCard.select(" div.card-mobile-duration" )
897- .map { it.text().trim() }
898- val reviews = infoBoxes.find { it.contains(" %" ) }
899- val views = infoBoxes.find { it.contains(" 次" ) }
900-
901- SubscriptionVideosItem (
902- title = title,
903- coverUrl = coverUrl,
904- videoCode = videoCode,
905- duration = duration,
906- views = views,
907- reviews = reviews
908- )
909- } catch (e: Exception ) {
910- null
887+ try {
888+ val link =
889+ videoCard.selectFirst(" a.overlay" )?.absUrl(" href" ) ? : return @mapNotNull null
890+ val videoCode = Regex (""" watch\?v=(\d+)""" ).find(link)?.groupValues?.get(1 )
891+ ? : return @mapNotNull null
892+ val imgs = videoCard.select(" img" )
893+ val coverUrl = imgs.getOrNull(1 )?.absUrl(" src" ) ? : return @mapNotNull null
894+ val title = videoCard.selectFirst(" div.card-mobile-title" )?.text()?.trim()
895+ ? : return @mapNotNull null
896+ val duration = videoCard.selectFirst(" div.card-mobile-duration" )?.text()?.trim()
897+ val infoBoxes = videoCard.select(" div.card-mobile-duration" )
898+ .map { it.text().trim() }
899+ val reviews = infoBoxes.find { it.contains(" %" ) }
900+ val views = infoBoxes.find { it.contains(" 次" ) }
901+
902+ SubscriptionVideosItem (
903+ title = title,
904+ coverUrl = coverUrl,
905+ videoCode = videoCode,
906+ duration = duration,
907+ views = views,
908+ reviews = reviews
909+ )
910+ } catch (_: Exception ) {
911+ null
912+ }
911913 }
912- }
913914
914915 return WebsiteState .Success (
915916 MySubscriptions (
0 commit comments