Skip to content

Instantly share code, notes, and snippets.

@bmuller
Created December 19, 2013 16:41
Show Gist options
  • Save bmuller/8042260 to your computer and use it in GitHub Desktop.
Save bmuller/8042260 to your computer and use it in GitHub Desktop.
from robostrippy.resource import attr, attrList, Resource
class Connection(Resource):
subject = attr("h2.postingtitle")
body = attr("section#postingbody")
datetime = attr("time", attribute = "datetime")
class ConnectionListItem(Resource):
url = attr("a", attribute = 'href')
@property
def details(self):
return Connection(self.absoluteURL(self.url))
class ConnectionsList(Resource):
connections = attrList("span.pl", ConnectionListItem)
clist = ConnectionsList('http://newyork.craigslist.org/mis/')
for connection in clist.connections:
print connection.details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment