File tree Expand file tree Collapse file tree
src/commonMain/kotlin/com/mugames/vidsnapkit Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ plugins {
2727}
2828
2929group = " io.github.udhayarajan"
30- version = " 5.3.8 "
30+ version = " 5.3.9 "
3131// Version Naming incremented if "<NEW_FEATURE_ADDED>.<WORKED_ON_BUG>.<BETA_VERSION_COUNT>"
3232// Priority on incrementing Feature > BugFix > Beta
3333
Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ class Instagram internal constructor(url: String) : Extractor(url) {
5252
5353 private suspend fun isCookieValid (): Boolean {
5454 if (cookies.isNullOrEmpty()) return false
55- val res = HttpRequest (" https://www.instagram.com/accounts/login/" , headers).getRawResponse(false )
55+ val res =
56+ HttpRequest (" https://www.instagram.com/accounts/login/" , headers).getRawResponse(false ) ? : return false
5657 if (res.status == HttpStatusCode .Found ) {
5758 val newLoc = res.headers[" location" ]!!
5859 val restrictedKeywords = listOf (" privacy/checks" , " challenge" , " coig_restricted" )
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ import java.util.regex.Pattern
3535 */
3636interface HttpInterface {
3737 suspend fun getData (url : String , headers : Hashtable <String , String >? = null): String?
38- suspend fun getRawResponse (url : String , headers : Hashtable <String , String >? = null): HttpResponse
38+ suspend fun getRawResponse (url : String , headers : Hashtable <String , String >? = null): HttpResponse ?
3939 suspend fun getSize (url : String , headers : Hashtable <String , String >? = null): Long
4040
4141 suspend fun postData (
@@ -173,17 +173,27 @@ class HttpInterfaceImpl(
173173 }
174174 }
175175
176- override suspend fun getRawResponse (url : String , headers : Hashtable <String , String >? ): HttpResponse {
177- return client.get {
178- url(url)
179- headers?.let {
180- if (it.isNotEmpty()) {
181- headers {
182- for ((key, value) in it)
183- append(key, value)
176+ override suspend fun getRawResponse (url : String , headers : Hashtable <String , String >? ): HttpResponse ? {
177+ return try {
178+ client.get {
179+ url(url)
180+ headers?.let {
181+ if (it.isNotEmpty()) {
182+ headers {
183+ for ((key, value) in it)
184+ append(key, value)
185+ }
184186 }
185187 }
186188 }
189+ } catch (e: Exception ) {
190+ var x = false
191+ client.config { x = followRedirects }
192+ logger.error(
193+ " getRawResponse() url=${url} header=${headers.toString()} clientRedirection=${x} Generic exception:" ,
194+ e
195+ )
196+ null
187197 }
188198 }
189199
You can’t perform that action at this time.
0 commit comments