Page 1 of 1

Webgadget Problem

Posted: Thu Oct 17, 2024 9:18 am
by Wolfram
Hello,

I want to program an automated download and have the following problem, when I call this page with the WebGadget, log in and then call the download link with SetgadgetText() I get the error “unauthorized”.
I think it has something to do with the cookies, but I don't see any point to influence it.
Does anyone have an idea how to automate these steps?

PS: if I log in to FireFox or Explorer and then enter the download link in the address bar, the download works.

Re: Webgadget Problem

Posted: Sat Oct 19, 2024 3:34 pm
by JHPJHP
Hi Wolfram,

I may I have a couple options, depending on how you answer the following questions:
1. What OS / PB version? You mention Explorer but the "signature" area of your profile states macOS Catalina.
2. Is a WebGadget (visual) mandatory? Sill not a problem, but there might be a path using a headless browser.
3. Are you able to share the URL, temporary credentials, anything that can help with testing?
4. Is this for personal use or will it be distributed? May narrow down your options if distributed.

Re: Webgadget Problem

Posted: Sat Oct 19, 2024 3:59 pm
by Wolfram
Hello JHPJHP,

this is latest project under Windows 11and PB 6.10.
2. A WebGadget is not mandatory. Wget works for this job, but I want to have a GUI. I guess it is a problem of the cookies or the session which seems to change if I do it this way.
3. The URL is a local Device.
4. No, it will not distributed.

Re: Webgadget Problem

Posted: Sat Oct 19, 2024 4:53 pm
by JHPJHP
Hi Wolfram,

I just sent you a PM containing a link to a full version download of my Chromium Framework.
Wolfram wrote:The URL is a local Device.
Try the following example:
\PureBasic WebGadget\CrWG Templates\2_Navigate_Website.pb.
1. Execute the code.
2. Navigate to the URL.
3. Manually login.
4. Navigate to the download URL.

Question: If you Navigate directly to the download URL does server authentication pop up?

If the first example worked, try the next example:
\PureBasic WebGadget\CrWG Examples\Authenticate_Proxy.pb.
• Should work with most server-based authentication, but I'm unsure this is what you're using.
1. Script: #Cr_WebGadget_Enable_Proxy_Server.
• Either change the IP address and port number to match your server or REM the line.
2. Execute the code.
3. Navigate to the URL after entering the username and password.
• If supported it will auto-authenticate.
• If not support there are numerous other options.
4. Navigate to the download URL.

Re: Webgadget Problem

Posted: Sun Oct 20, 2024 8:47 am
by Wolfram
Hello JHPJHP,

sounds good and I will try it.
Unfortunately the PM is on hold and I can't read it at the moment.

Re: Webgadget Problem

Posted: Mon Oct 28, 2024 5:22 pm
by JHPJHP
Hi Wolfram,

I moved our PM to Coding Questions so that others using the Framework can benefit.
Wolfram wrote:Do you know is there any way to have a callback for download is finished?
Can I define my own download folder?
It was easier for me to create you an example then fumble through the directions.
• Download the latest version of the Framework, use the link from our previous PM.
• See the example: \PureBasic WebGadget\CrWG Examples\Download_Progress.pb.

Instructions:
1. Press the Navigate button.
2. Select a download link from the PureBasic website.
• The download will save to the Desktop; user-defined location.
• The download will display a filename, progress bar status and status text.
3. Select the Checkbox to disable downloading.

There are literally thousands of accessible events without having to code anything.
• Most of these events are turned off until a Domin is enabled.
• Enabling a domain is as easy as it sounds: Page_Enable(Connection, EventID).

See the following template, it demonstrates how to enable the built-in debugger.
\PureBasic WebGadget\CrWG Templates\3_Debug_Events.pb

Read my PDF help files for a better understanding of the Framework.
\PureBasic WebGadget\Shared Files\references\

In addition, visit the Chrome DevTools Protocol website, it's an invaluable resource.

Re: Webgadget Problem

Posted: Wed Oct 30, 2024 8:40 am
by Wolfram
Unfortunately the file "\PureBasic WebGadget\CrWG Examples\Download_Progress.pb" is missing.

Re: Webgadget Problem

Posted: Thu Oct 31, 2024 4:35 am
by JHPJHP
Hi Wolfram,

I just sent you another PM with a link to the Chromium Framework.

Image

Re: Webgadget Problem

Posted: Thu Nov 07, 2024 8:26 pm
by Wolfram
Thank you very much JHPJHP.
Your work has helped me a lot. The framework offers a lot of possibilities.

At the moment I am still looking for a solution to send a postrequest.

Re: Webgadget Problem

Posted: Thu Nov 07, 2024 9:11 pm
by JHPJHP
Hi Wolfram,

That's great to hear.

Sending a POST Request can also be done from my Chromium Framework, through DevTools Protocol using the Fetch Domain.

See the following examples, both using the Fetch Method for very different purposes.
• \PureBasic WebGadget\CrWG Example\Allow_Block_Website.pb
• \PureBasic WebGadget\CrWG Example\Authenticate_Proxy.pb

Let me know if you require additional information or help with some code.

Re: Webgadget Problem

Posted: Sat Nov 09, 2024 7:33 pm
by Wolfram
Hello JHPJHP,

I tried the Authenticate_Proxy.pb example to log in to this forum, but it doesn't work.
I am trying this without a proxy as I don't have one.

Re: Webgadget Problem

Posted: Sun Nov 10, 2024 5:08 am
by Randy Walker
JHPJHP wrote: Sat Oct 19, 2024 4:53 pm Hi Wolfram,

I just sent you a PM containing a link to a full version download of my Chromium Framework.
Hi Wolfram,
Send that guy a cup of coffee. :mrgreen:

Re: Webgadget Problem

Posted: Sun Nov 10, 2024 7:18 pm
by JHPJHP
Hi Randy Walker,

Thank you. As per our arrangement, I'll have your weekly cut dropped at the usual spot :lol:

-------------------------------

Hi Wolfram,

I just sent you a PM containing a link to an updated version of my Chromium Framework.

Three examples have been added:
• \PureBasic WebGadget\CrWG Example\Authenticate_Basic_1.pb
• \PureBasic WebGadget\CrWG Example\Authenticate_Basic_2.pb
• \PureBasic WebGadget\CrWG Example\Authenticate_Form.pb

Authenticate_Basic_1.pb and Authenticate_Basic_2.pb
➤ Two different methods to automate (basic) server authentication.
Authenticate_Basic_1.pb uses the Fetch Domain.
Authenticate_Basic_2.pb uses the Network Domain.

Authenticate_Form.pb
• Simple JavaScript method to provide credentials and submit a form.
• Current configuration is setup to login to the PureBasic forum.

With the example Authenticate_Form.pb the timer could be replaced by a delay, and under most circumstances isn't needed. phpBB is known for monitoring things that happen too fast, trying to prevent BOTS and automation scripts like this from posting.

Re: Webgadget Problem

Posted: Wed Nov 13, 2024 7:10 am
by Randy Walker
JHPJHP wrote: Sun Nov 10, 2024 7:18 pm Hi Wolfram,

I just sent you a PM containing a link to an updated version of my Chromium Framework.
Hi Wolfram,
Wow! Seriously. You need to send that guy a cup of coffee or two. :mrgreen: