Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Udhayarajan committed Jul 23, 2023
1 parent 40a7284 commit e75f933
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ abstract class Extractor(
HttpRequestService.create(storage = str)
}


/**
* If media is private just pass valid cookies to
* extract list of [Formats]
Expand Down Expand Up @@ -272,22 +271,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()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ class Facebook internal constructor(url: String) : Extractor(url) {
videoData.get("original_width")
.toString() + "x" + videoData.get("original_height") + "(" + s.uppercase() + ")",

)
)
)
}
return SUCCESS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,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)))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ interface HttpRequestService {
suspend fun getResponse(
url: String,
headers:
Hashtable<String, String>? = null,
Hashtable<String, String>? = null,
): String?

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ class HttpRequestServiceImpl(private val client: HttpClient) : HttpRequestServic
val body = bodyAsText()
logger.warn(
"Unhandled in getData() status code=$status for url=$url with headers=$headers &\n response=${
body.substring(
min(body.length, 2000)
)
body.substring(
min(body.length, 2000)
)
}"
)
null
Expand Down

0 comments on commit e75f933

Please sign in to comment.