Jump to content
hakin

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

Share this post


Link to post

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.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...