wget-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wget2 | Add support for pre/post download scripts (#80)


From: @rockdaboot
Subject: Re: wget2 | Add support for pre/post download scripts (#80)
Date: Fri, 29 Mar 2024 16:53:31 +0000



Tim Rühsen commented: 
https://gitlab.com/gnuwget/wget2/-/issues/80#note_1838279280

TBH, I didn't look into the plugin API since a long time. Today I did :)

It allows you to set a callback function that is called for each enqueued URL.
And there is an API that allows you to reject, accept or change the URL.
I currently don't have a concrete use-case, but I am happy to share some simple 
code for a plugin.

[rewrite_url.c](/uploads/77fd01e581e52b7b393c9f9e39a13bb3/rewrite_url.c)
[Makefile](/uploads/9c006b405cbffd0e8357685f105c0bcc/Makefile)

On Debian, you can install the package `wget2-dev` first. Or you build wget2 
from source and install it with `sudo make install`.

Then put the two files above into an own directory and do `make` to build the 
plugin (rewrite_url.so).

Now you can use it with `wget2 --content-on-error --local-plugin=rewrite_url.so 
--progress=none example.com`.

Instead of rewriting the URL, you can simply reject it by calling 
`wget_intercept_action_reject(action)`.

Here are the online docs: 
https://gnuwget.gitlab.io/wget2/reference/plugin_8c.html

These are first steps, let me know your feedback.

-- 
Reply to this email directly or view it on GitLab: 
https://gitlab.com/gnuwget/wget2/-/issues/80#note_1838279280
You're receiving this email because of your account on gitlab.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]