LoWang Posted April 18, 2023 Share Posted April 18, 2023 (edited) Hello, please advise how and if can I fix this. This code worked for several months but seems like something has changed on the server (cipher version maybe?) and it doesn't return anything now. I see that $oHTTP.Status contains 401. $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET","https://www.duolingo.com/2017-06-30/users?username=Marecustitus", False) $oHTTP.Send() consolewrite($oHTTP.ResponseText&@crlf) consolewrite("http error: "&$oHTTP.Status&@crlf) Edited April 18, 2023 by LoWang Link to comment Share on other sites More sharing options...
Solution TheXman Posted April 18, 2023 Solution Share Posted April 18, 2023 (edited) It appears that they are now filtering out requests that do not have a "valid" User-Agent. By adding a User-Agent from any popular browser, it should work. Other User-Agent strings may work too, like the default one sent by cURL (in my case "User-Agent: curl/8.0.1"). The example below is exactly the same as yours with the addition of a Firefox User-Agent header. It worked for me. $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET","https://www.duolingo.com/2017-06-30/users?username=Marecustitus", False) $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0") $oHTTP.Send() consolewrite($oHTTP.ResponseText&@crlf) consolewrite("http error: "&$oHTTP.Status&@crlf) Console: (with redactions) {"users":[{"joinedClassroomIds":[],"streak":160,"motivation":"brain","acquisitionSurveyReason":"friendsOrFamily","shouldForceConnectPhoneNumber":false,"picture":"redacted","learningLanguage":"en","hasFacebookId":false,"shakeToReportEnabled":null,"liveOpsFeatures":[],"canUseModerationTools":false,"id":000000000,"betaStatus":"INELIGIBLE","hasGoogleId":false,"privacySettings":[],"fromLanguage":"cs","hasRecentActivity15":false,"_achievements":[],"observedClassroomIds":[],"username":"redacted","bio":"","profileCountry":"CZ","globalAmbassadorStatus":{},"currentCourseId":"DUOLINGO_EN_CS","hasPhoneNumber":false,"creationDate":1619983341,"achievements":[],"hasPlus":false,"name":"redacted","roles":["users"],"classroomLeaderboardsEnabled":false,"emailVerified":false,"courses":[{"preload":false,"placementTestAvailable":false,"authorId":"duolingo","title":"English","learningLanguage":"en","xp":19391,"healthEnabled":true,"fromLanguage":"cs","crowns":52,"id":"DUOLINGO_EN_CS"}],"totalXp":19391,"streakData":{"currentStreak":{"startDate":"2022-10-15","length":160,"endDate":"2023-04-18"}}}]} http error: 200 Edited April 18, 2023 by TheXman LoWang and argumentum 2 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now