From 964f2e8266ced9359d6d4b302fbb3b9a58d85f10 Mon Sep 17 00:00:00 2001 From: udhayarajan Date: Mon, 24 Jul 2023 21:17:01 +0530 Subject: [PATCH] fix: lint --- .../kotlin/com/mugames/vidsnapkit/Util.kt | 4 ++-- .../mugames/vidsnapkit/extractor/Extractor.kt | 18 +++++++++--------- .../mugames/vidsnapkit/extractor/Facebook.kt | 2 +- .../mugames/vidsnapkit/extractor/Instagram.kt | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/commonMain/kotlin/com/mugames/vidsnapkit/Util.kt b/src/commonMain/kotlin/com/mugames/vidsnapkit/Util.kt index 40888b68..dcd94b76 100644 --- a/src/commonMain/kotlin/com/mugames/vidsnapkit/Util.kt +++ b/src/commonMain/kotlin/com/mugames/vidsnapkit/Util.kt @@ -39,8 +39,8 @@ class Util { */ fun decodeHTML(text: String?): String? { if (text == null) return null - var data = text.replace("%(?![0-9a-fA-F]{2})".toRegex(), "%25"); - data = data.replace("\\+".toRegex(), "%2B"); + var data = text.replace("%(?![0-9a-fA-F]{2})".toRegex(), "%25") + data = data.replace("\\+".toRegex(), "%2B") val decoder = HtmlDecoderFactory.createDecoderFactory() val decoded = decoder.decodeHtml(data) // decoded = HtmlCompat.fromHtml(text, HtmlCompat.FROM_HTML_MODE_LEGACY).toString() diff --git a/src/commonMain/kotlin/com/mugames/vidsnapkit/extractor/Extractor.kt b/src/commonMain/kotlin/com/mugames/vidsnapkit/extractor/Extractor.kt index 54fbf9aa..7e2a2401 100644 --- a/src/commonMain/kotlin/com/mugames/vidsnapkit/extractor/Extractor.kt +++ b/src/commonMain/kotlin/com/mugames/vidsnapkit/extractor/Extractor.kt @@ -293,22 +293,22 @@ abstract class Extractor( private fun getRandomInstagramUserAgent(): String { val userAgents = listOf( "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 " + - "Safari/537.36", + "Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 " + - "Safari/537.36", + "Safari/537.36", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) " + - "Chrome/74.0.3729.169 Safari/537.36", + "Chrome/74.0.3729.169 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 " + - "Safari/537.36", + "Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 " + - "Safari/537.36", + "Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 " + - "Safari/537.36", + "Safari/537.36", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 " + - "Safari/537.36", + "Safari/537.36", "Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) " + - "Mobile/15E148 Instagram 105.0.0.11.118 (iPhone11,8; iOS 12_3_1; en_US; en-US; scale=2.00; " + - "828x1792; 165586599)" + "Mobile/15E148 Instagram 105.0.0.11.118 (iPhone11,8; iOS 12_3_1; en_US; en-US; scale=2.00; " + + "828x1792; 165586599)" ) return userAgents.random() } diff --git a/src/commonMain/kotlin/com/mugames/vidsnapkit/extractor/Facebook.kt b/src/commonMain/kotlin/com/mugames/vidsnapkit/extractor/Facebook.kt index 20d149ce..d678a953 100644 --- a/src/commonMain/kotlin/com/mugames/vidsnapkit/extractor/Facebook.kt +++ b/src/commonMain/kotlin/com/mugames/vidsnapkit/extractor/Facebook.kt @@ -579,7 +579,7 @@ class Facebook internal constructor(url: String) : Extractor(url) { videoData.get("original_width") .toString() + "x" + videoData.get("original_height") + "(" + s.uppercase() + ")", - ) + ) ) } return SUCCESS diff --git a/src/commonMain/kotlin/com/mugames/vidsnapkit/extractor/Instagram.kt b/src/commonMain/kotlin/com/mugames/vidsnapkit/extractor/Instagram.kt index 5dbc3f4e..7d8ff889 100644 --- a/src/commonMain/kotlin/com/mugames/vidsnapkit/extractor/Instagram.kt +++ b/src/commonMain/kotlin/com/mugames/vidsnapkit/extractor/Instagram.kt @@ -197,10 +197,10 @@ class Instagram internal constructor(url: String) : Extractor(url) { private suspend fun extractMusicAssetInfo(assetInfo: JSONObject) { formats.title = assetInfo.getNullableString("title")?.ifEmpty { null } ?: assetInfo.getNullableString("subtitle") - ?.ifEmpty { null } ?: "Reels_audio ${assetInfo.getNullableString("display_artist")}" + ?.ifEmpty { null } ?: "Reels_audio ${assetInfo.getNullableString("display_artist")}" val imageUrl = assetInfo.run { getNullableString("cover_artwork_uri")?.ifEmpty { null } ?: getNullableString("cover_artwork_thumbnail_uri") - ?: getJSONObject("music_composition_info").getString("placeholder_profile_pic_url") + ?: getJSONObject("music_composition_info").getString("placeholder_profile_pic_url") } formats.imageData.add(ImageResource(imageUrl, Util.getResolutionFromUrl(imageUrl)))