refactor url encoded form requests

This commit is contained in:
Brahim Hadriche committed 2024-02-26 18:44:57 -05:00
1 parent edbfc86e56
commit f2ffb42876
4 files changed
+33 -30

No files matched your search

@@ -23,15 +23,15 @@ function LoungeGenerateManualPairingCodeTask(input as object) as object
input.loungeToken = loungeService.loungeToken
end if
bodyParams = {
form = {
"lounge_token": input.loungeToken
"screen_id": input.screenId
"screen_name": input.screenName
"device_id": input.deviceId
}
for each key in bodyParams
if StringUtils.IsNullOrEmpty(bodyParams[key])
for each key in form
if StringUtils.IsNullOrEmpty(form[key])
return {
"success": false
"error": key + " is empty"
@@ -39,14 +39,11 @@ function LoungeGenerateManualPairingCodeTask(input as object) as object
end if
end for
bodyParams["access_type"] = "permanent"
bodyParams["app"] = "Playlet"
form["access_type"] = "permanent"
form["app"] = "Playlet"
baseUrl = "https://www.youtube.com/api/lounge/pairing/get_pairing_code?ctx=pair"
body = UrlUtils.GetUrlEncodedForm(bodyParams)
request = HttpClient.Post(baseUrl, body)
request.Header("Content-Type", "application/x-www-form-urlencoded")
request = HttpClient.Post("https://www.youtube.com/api/lounge/pairing/get_pairing_code?ctx=pair", "")
request.UrlEncodedForm(form)
response = request.Await()
if not response.IsSuccess()