urlwatch icon indicating copy to clipboard operation
urlwatch copied to clipboard

How to use this with a user-login page

Open uidis0 opened this issue 4 years ago • 6 comments

Hi, I'd like to use this tool to monitor changes on a webpage that is only accessible once I've logged in. How can I achieve this with this tool? Thanks

uidis0 avatar Nov 12 '19 18:11 uidis0

It's not currently supported.

cfbao avatar Nov 13 '19 00:11 cfbao

Could I add support through something like this? https://stackoverflow.com/questions/2910221/how-can-i-login-to-a-website-with-python

Thanks

uidis0 avatar Nov 15 '19 10:11 uidis0

You can try.

cfbao avatar Nov 16 '19 16:11 cfbao

Depending on how the login is managed, sometimes you can log into the page using your browser, and then get the cookies from the browser (e.g. by exporting a cookies.txt -- there are plugins for some browsers that do that) and then read up on Supplying cookie data in the docs.

Make sure you do NOT log out of the session from the browser, as otherwise the cookie session will be invalidated on the server side. Depending on how long sessions are valid, you might need to update the cookie information every now and then.

thp avatar Jul 10 '20 14:07 thp

Unfortunately, this doesn't really explain the complexities of translating a cookies.txt file into something that will work with URL-Watch's YAML interface. What gets generally parsed as "name" : "value" in netscape cookies becomes "key" : "value" in the examples.

Sadly, even with these translations, the implementation of cookiejar.py used by this project is unable to parse the more elaborate cookies used by sites these days. When cookies contain characters like %, it becomes impossible to save them using urlwatch --edit unless you wrap them in something like a single or double quotation mark, which then causes the program to fail on runtime because it can't determine if they are strings or integers and it tries to perform a > evaluation on them.

Anyone know a way around this?

Kezzsim avatar Oct 25 '22 04:10 Kezzsim

When cookies contain characters like %, it becomes impossible to save them using urlwatch --edit unless you wrap them in something like a single or double quotation mark, which then causes the program to fail on runtime because it can't determine if they are strings or integers and it tries to perform a > evaluation on them.

Where did you experience this? Do you have a traceback / example data for this issue? Sounds like a legitimate bug.

thp avatar Oct 27 '22 06:10 thp