in reply to Re: How can I extract an email behind a JS button?
in thread How can I extract an email behind a JS button?

Hi Corion, here is what I tried as far as mimicking what the button click did. I used Mozilla developer to look at the post command and used the transmitted data however what I'm sending looking to be in the wrong format as it's returning an error. From what I know it's supped to be in this format and what I used is right after:

$mech->post(Request_URL, Content => {FORM_FIELDS...});

$mech->post(https://reporter.nih.gov/services/Projects/PiPoEmails, Content => {project_id:”10702248”});
$mech->post(https://reporter.nih.gov/services/Projects/PiPoEmails, Con +tent => {recaptcha:"03AFcWeA7e6fsRQ02z43ij7N6u2b9lXbajsQs_cLex50-fcjO +zm8w17PogPUhTf2cTarSroDhsqdGVng0ZMJNtI_yykUez7G8bIDhaL6y2AD1W4JJrzTkG +jDiqa_S-yHy15f2jVN-oSPB_idz9PvvYUGZ60ZeJq7WHA7VJJFbp-qha3RGA2A3RmA9ri +vViSdSK_pCYMVGzuGrQCX3ym-0TXy6a2xWVOSijy6fG0ReXO-8IhYtnSn_uUstoAZSfCK +xRJzquCh2EmIb41GTOrApRN-osiE-1l4cc84tKvngBoiUsLiOeTJasoudWCQ-9ID3eUtj +ucB6wKEVwtdvBCxdLlidPL5E9wHQUiJFGl-sun6gEzqVfZ4nQfUTi-CZ0SB2GJhu2-EDI +pkBdq75AzwwjHqT5vS-Q_PS11hRAosELBWf3-RY_DyrG5iYJhuFFerZOE4ymD20EN9hKw +_tAkPuFi9OkKXFNsiGx0toZ5jIFiPJaSe1EaAShNfW8Vy_f7BMDEo3U6Kx-dKEyDL3zHm +smyCeXZDsiyeDWfvQEoET1tESwZjQVhHDuDZUHwhYZKZUPMFVI3MvhxHglIkrxOcllwv7 +NUopJxnS9TOrU6uQG1ag56DMZ36EZ3RFRBrvEXn430ek8I89SqcyYWDwkjMvg3dkjBct4 +3QstZw"});

If someone could LMK where the formatting errors are in what I'm posting I'd greatly appreciate it. Thanks!

Replies are listed 'Best First'.
Re^3: How can I extract an email behind a JS button?
by Corion (Patriarch) on Mar 16, 2024 at 07:23 UTC

    You need to learn and understand what you are seeing.

    The POST is the solved Recaptcha to verify that you are human. You cannot easily replicate that using a POST command.

    I would guess that the best approach is to use the ->click() command.

      So the browser posts include the captcha though all you need to do is click the email button to see it, no solving anything required. So If I just need to send the first post what am I getting wrong with the format here?

      Format I found:

      $mech->post(Request_URL, Content => {FORM_FIELDS...});

      What I tried:

      $mech->post(https://reporter.nih.gov/services/Projects/PiPoEmails, Content => {project_id:”10702248”});

        "Format I found" is not really a substitute for reading the documentation at WWW::Mechanize::Chrome. I already suggested looking at the ->click method.

        You don't tell us how what you tried fails, and posting small unconnected snippets does not let us reproduce your situation. Consider posting an SSCCE.