MuffettsMan Posted April 16, 2020 Posted April 16, 2020 my code runs in a looooong loop and runs fine for a while but then crashes at random with the following errors: --> IE.au3 T3.0-2 Error from function _IENavigate, $_IESTATUS_InvalidObjectType --> IE.au3 T3.0-2 Error from function _IENavigate, $_IESTATUS_InvalidObjectType --> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidObjectType () --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidObjectType --> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidObjectType () --> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidObjectType TITLE: 0 --> IE.au3 T3.0-2 Error from function _IETagNameGetCollection, $_IESTATUS_InvalidObjectType actual code (its hitting a local Nginx server to get a list of URLs to loop through and signup udemy classes with lol (it works when you are already logged into udemy) - though technically if anyone runs it as it is will mess up my tracking as that update.php returns the user_id of the current friend I'm hooking up with classes lol expandcollapse popup#include <file.au3> #include <IE.au3> $file = FileOpen("urls.txt", 0) $found = 0 $oIE = _IECreate(1, 1) _IENavigate($oIE, "http://nerdsolve.com/udemy/list.php") _IELoadWait($oIE) $sHTML = _IEDocReadHTML($oIE) $sHTML = StringReplace($sHTML, "<html><head></head><body>", "") $sHTML = StringReplace($sHTML, "</body></html>", "") $urls = StringSplit($sHTML, "<br>", 1) _IEQuit($oIE) For $i = 1 To $urls[0] ; ConsoleWrite($urls[$i] & @CRLF) $url_arr = StringSplit($urls[$i], "|", 1) $coupon_id = $url_arr[1] $coupon_url = $url_arr[2] ConsoleWrite("ID: " & $coupon_id & " URL: " & $coupon_url & @CRLF) $oIE = _IECreate(1, 1) _IENavigate($oIE, $coupon_url) _IELoadWait($oIE) $hIE = _IEPropertyGet($oIE, "HWND") WinActivate($hIE) _IELoadWait($oIE) ; _IEPropertySet($oIE, "theatermode", True) $title = _IEPropertyGet($oIE, "title") ConsoleWrite ("TITLE: " & $title & @CRLF) If ($title == 'Access to this page has been denied.') Then $oIE = _IEAttach($coupon_url, "url") Local $hIE ; Force to get window handle While Not IsHWnd($hIE) $hIE = _IEPropertyGet($oIE, "hwnd") Sleep(10) WEnd ConsoleWrite($hIE & @CRLF) ; Force activation of window While Not WinActive($hIE) WinActivate($hIE) Sleep(10) WEnd sleep(2000) WinSetState($hIE, "", @SW_MAXIMIZE) sleep(2000) MouseClick("left",202, 412) EndIf ; MouseClick($MOUSE_CLICK_LEFT, 917, 328) ; udlite-btn udlite-btn-small udlite-btn-secondary udlite-heading-sm udlite-btn-experiment-primary styles--btn--express-checkout--28jN4 ; udlite-btn udlite-btn-small udlite-btn-secondary udlite-heading-sm udlite-btn-experiment-primary styles--btn--express-checkout--28jN4 ; _IENavigate($oIE, 'javascript:document.querySelector(".udlite-btn udlite-btn-small udlite-btn-secondary udlite-heading-sm udlite-btn-experiment-primary styles--btn--express-checkout--28jN4").button') ; data-purpose == "buy-this-course-button" $oInputs = _IETagNameGetCollection($oIE, "button") Local $sTxt = "" $target = "" For $oInput In $oInputs ; ConsoleWrite ( $oInput.type & " - InnerText: " & $oInput.innertext & @CRLF) If ($oInput.innertext == 'Enroll now') Then ConsoleWrite ("FOUND BUTON....") $target = $oInput _IELoadWait($target,"",Random(1500, 3500, 1)) _IEAction($target, "click") $found = 0 sleep(250) _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=successful&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf If ($oInput.innertext == 'Go to course') Then ConsoleWrite ("FOUND BUTON.... already enrolled...") $target = $oInput $found = 0 sleep(250) _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=previously enrolled&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf If ($oInput.innertext == 'Add to cart') Then ConsoleWrite ("Add to cart dead link") $target = $oInput $found = 0 sleep(250) _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=failed&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf Next ; http://nerdsolve.com/udemy/update.php?user_id=2&status=successful&coupon_id=231 ; http://nerdsolve.com/udemy/list.php ; check if no longer available..... $oInputs = _IETagNameGetCollection($oIE, "h4") Local $sTxt = "" $target = "" For $oInput In $oInputs ; ConsoleWrite ( "H4 - InnerText: " & $oInput.innertext & @CRLF) ; eventually want to update a db or something here to remove it from trying again.... If (StringInStr ($oInput.innertext, 'available')) Then ConsoleWrite ("no longer available" & @CRLF) $found = 0 _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=failed&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf Next For $oInput In $oInputs ; ConsoleWrite ( "H4 - InnerText: " & $oInput.innertext & @CRLF) ; eventually want to update a db or something here to remove it from trying again.... If (StringInStr ($oInput.innertext, 'approved')) Then ConsoleWrite ("not approved" & @CRLF) $found = 0 _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=failed&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf Next ; check if no longer available..... $oInputs = _IETagNameGetCollection($oIE, "h2") Local $sTxt = "" $target = "" For $oInput In $oInputs ; ConsoleWrite ( "H4 - InnerText: " & $oInput.innertext & @CRLF) ; eventually want to update a db or something here to remove it from trying again.... If (StringInStr ($oInput.innertext, 'available')) Then ConsoleWrite ("no longer available" & @CRLF) $found = 0 _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=failed&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf Next ; check if no longer available..... $oInputs = _IETagNameGetCollection($oIE, "div") Local $sTxt = "" $target = "" For $oInput In $oInputs ; ConsoleWrite ( "H4 - InnerText: " & $oInput.innertext & @CRLF) ; eventually want to update a db or something here to remove it from trying again.... If (StringInStr ($oInput.innertext, 'approved')) Then ConsoleWrite ("not approved" & @CRLF) $found = 0 _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=failed&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf ;Enter Password If (StringInStr ($oInput.innertext, 'Enter Password')) Then ConsoleWrite ("Enter Password" & @CRLF) $found = 0 _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=failed&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf ; Request Invitation If (StringInStr ($oInput.innertext, 'Request Invitation')) Then ConsoleWrite ("Request Invitation" & @CRLF) $found = 0 _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=failed&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf ; enrollments If (StringInStr ($oInput.innertext, 'enrollments')) Then ConsoleWrite ("enrollments" & @CRLF) $found = 0 _IENavigate($oIE, "http://nerdsolve.com/udemy/update.php?user_id=5&status=failed&coupon_id=" & $coupon_id) _IELoadWait($oIE) ExitLoop EndIf Next $found = $found + 1 If ($found > 15) Then ConsoleWrite('ERROR - Failed to enroll on 15 in a row' & @CRLF) Exit EndIf sleep(Random(1500, 3500, 1)) _IEQuit($oIE) Next #cs id to 25476 data-purpose == "buy-this-course-button" _IELinkClickByText($oIE, "Upload") #ce Don't let that status fool you, I am no advanced memeber!
Moderators JLogan3o13 Posted April 16, 2020 Moderators Posted April 16, 2020 @MuffettsMan I am curious why your code appears to be trying to enroll in a large number of udemy classes all at once. Reading through their TOS, this seems to go against their section on proper usage. You can't possibly be planning on taking 5000+ courses, so how about a detailed explanation on what you are trying to do? ======In case you missed it, this is a Mod stepping into a thread====== "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
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