Results 1 to 3 of 3

Thread: Logging into Neopets - Python and Javascript/jQuery

  1. #1
    Sephora's Avatar
    Joined
    Jan 2018
    Posts
    273
    Pronouns
    she/her
    Userbars
    59
    Thanks
    1,875
    Thanked
    1,512/331
    DL/UL
    5/0
    Mentioned
    184 times
    Time Online
    127d 13h 14m
    Avg. Time Online
    1h 20m

    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.



    I tried it like this as well but got the same thing


    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.

  2. #2
    ozfe's Avatar
    Joined
    Dec 2012
    Posts
    56
    Userbars
    2
    Thanks
    9
    Thanked
    26/23
    DL/UL
    23/0
    Mentioned
    21 times
    Time Online
    16d 17m
    Avg. Time Online
    5m
    Hope I can help a bit from my experiences.

    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:

    $webDriver->findElement(WebDriverBy::cssSelector('form .welcomeLoginButton'))->click();

  3. The Following User Says Thank You to ozfe For This Useful Post:

    Sephora (11-01-2020)

  4. #3
    Sephora's Avatar
    Joined
    Jan 2018
    Posts
    273
    Pronouns
    she/her
    Userbars
    59
    Thanks
    1,875
    Thanked
    1,512/331
    DL/UL
    5/0
    Mentioned
    184 times
    Time Online
    127d 13h 14m
    Avg. Time Online
    1h 20m
    @(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:


    And I was able to log in like this:



    For the question 3, I got the solution from someone on StackOverflow. I only had to do
    Code:
     $('.welcomeLoginButton')[0].click();
    or
    Code:
     document.getElementsByClassName("welcomeLoginButton")[0].click();
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •