You're looking at Less Wrong's discussion board. This includes all posts, including those that haven't been promoted to the front page yet. For more information, see About Less Wrong.

toonalfrink comments on The Web Browser is Not Your Client (But You Don't Need To Know That) - Less Wrong Discussion

22 Post author: Error 22 April 2016 12:12AM

You are viewing a comment permalink. View the original post to see all comments and the full post content.

Comments (47)

You are viewing a single comment's thread.

Comment author: toonalfrink 01 June 2016 08:30:51PM *  0 points [-]

But consider the following problem: Find and display all comments by me that are children of this post, and only those comments, using only browser UI elements, i.e. not the LW-specific page widgets. You cannot -- and I'd be pretty surprised if you could make a browser extension that could do it without resorting to the API, skipping the previous elements in the chain above. For that matter, if you can do it with the existing page widgets, I'd love to know how.

This is actually trivial (but it breaks readily if LW changes it's stylesheet):

from lxml import html
root = html.open("<http://lesswrong.com/lw/njn/the_web_browser_is_not_your_client_but_you_dont/>").getroot()
for div in root.cssselect(".comment-meta"):
if div.cssselect("span.author")[0].text_content() == "Error":
print div.text_content()