On Fri, Oct 05, 2007 at 12:39:02PM +0200, Matej Kopal wrote:
> Hi,
> I start using Elinks web browser and everything was fine until I start
> using a cookies. I import Mozilla (Firefox) cookie file. I mean I copy
> Firefox cookie file into home directory of Elinks ( ~/.elinks/cookies
> ). But it looks like Elinks and Firefox has different cookies file
> format.
>
> So I browse a web and I found perl script
> (http://www.cryptosystem.org/archives/2006/04/converting-netscape-cookies-files/
> ) which should convert Netscape cookies into Elinks cookies, but it
> was not working for me. May be I am doing something wrong, but I have
> no clue how Elinks format should look.
>
> So can you help me with this cookies conversion problem or just
> forward me on right way.
Here is a simple Python script to convert Mozilla cookies to the ELinks format.
Usage, eg. $ python cook.py file_with_mozilla_cookies >> ~/.elinks/cookies
--
Witek
#!/usr/bin/env python
import sys
from cookielib import *
def main():
if len(sys.argv) == 1:
print "Usage:", sys.argv[0], "filename_with_mozilla_cookies"
return 1
cookies = MozillaCookieJar()
cookies.load(sys.argv[1])
for cookie in cookies:
cookie.domain = cookie.domain[1:]
print "%s\t%s\t%s\t%s\t%s\t%d\t%d" % (cookie.name,
cookie.value, cookie.domain, cookie.path, cookie.domain, cookie.expires,
cookie.secure)
if __name__ == '__main__':
main()
_______________________________________________
elinks-users mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-users