Logging into Neopets - Python and Javascript/jQuery
1) I looked at the tutorial (you need an account to see links) and tried to login in a similar way but I discovered all HTTP requests are blocked by StackPath. Is it possible to bypass StackPath and log in to Neopets via HTTP request? If anyone knows how to log in programmatically, could you share a snippet of code? It doesn't have to be in Python, I am willing to code in other languages.
2) I also attempted to login through a GreaseMonkey userscript but I got the 'No username found! Please go back and re-enter your username' page. I'm confused since I think I'm providing it with the right parameters.
3) Lastly, I had the userscript go to the (you need an account to see links), auto-fill the username and password, but I could not get the script to hit the green 'Login' button.
I would love if someone could share a solution to any of these three questions. Ideally, I would like to know how to login through both GreaseMonkey userscripts and an IDE.
1. Login:
From what I can see, you are just using the plain Pythons session mechanism. I'm not that familiar with Python, but in Kayses tutorial, it seems that the NeoAccount class wraps the Python requests and adds the referrer and headers (such as the User-agent).
If your Python script is submitting the default Python user agent header, it would be extremely easy for StackPath to detect it as spam.
You could also encounter StackPath issues if you're using a bad proxy or VPN.
2. Unknown username: not 100% sure about this, but looks like there is another variable called pageResponse. It might also check the cookies and headers.
3. There is no element with name = welcomeLoginButton. There is a '.welcomeLoginButton' (class), but they've also done something weird to it, preventing $('form .welcomeLoginButton').click() from working.
By "through an IDE" do you mean using Selenium?
WebDriverWait looks like something Selenium-related. This following for me in PHP (I presume the code would be similar in JS), assuming you have waited for everything to load:
@(you need an account to see links) Thanks so much for your help! I disabled my VPN, added in headers, and I was able to successfully log in and get the html of pages.
I was able to get the HTML of the home page like this:
Still seeking a solution to question 2 and would appreciate it very much if someone knows.
By IDE, I mean an integrated development environment like PyCharm, Spyder, Eclipse. Basically software you can download onto your computer that allows you to view code and run it.
Last edited by Sephora; 11-01-2020 at 04:50 PM.
Reason: Found a solution to one of the problems