Jump to content

Workflow to open a website, crawl a value by xpath and return it as a result in Alfred

Recommended Posts

I am just new to Alfred and trying to write some workflows that I can use. 


The use case I am facing a lot is, opening  a page and checking the value of something. I want to write a script that opens the page, crawls the value by xpath or regex, and prints it as a list item in Alfred. This sounds like a very common case, so wanted to ask if there is a tutorial or sample code for this..

Edited by hakin
Link to comment

Here's a workflow that scrapes results from a webpage and shows them in Alfred.


Here's a tutorial on writing Script Filters (i.e. showing your own results in Alfred) and here's a tutorial on web scraping with Beautiful Soup. Beautiful Soup doesn't support XPath, but it does support regexes and a subset of CSS selectors.


You can use XPath selectors with lxml, but that can be a bit of a pain to install on OS X.

Link to comment
  • 4 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...