I want to read user input in Python to get a url (e.g. http://www.google.com) and then print the web page in HTML formatting (text only) to the terminal. I tried using pexpect.spawn('elinks') but elinks doesn’t seem to write to stdout. I also looked at the HTMLParser module, but I don’t know how I format the resulting text into something resembling a webpage. Any advice?
I want to read user input in Python to get a url (e.g. http://www.google.com
Share
This is no small challenge. The fact that you want to spawn
elinksmakes me wonder why you don’t just use it instead. See what extensibility/plugin/addon options it has, or try rewriting it to suit your specific needs.Ultimately, you’ll need to write your own browser layout engine with a curses backend. If you’re using python,
urwidis a popular choice for curses layouts.