Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Anyone know if there is a way to search Reading List?

Not necessarily the full text of the pages — but at least the titles/descriptions that you see when looking at the Reading List pane within Safari:

enter image description here

share|improve this question

2 Answers 2

up vote 2 down vote accepted

I am not aware of any options in Safari. Neither the search option under Help, nor the search option under All Bookmarks yielded any results.

But, OSX's Spotlight did index the reading list: Results appear in the section Webpages.

First I added the webpage to the reading list. Then I reset Safari.

enter image description here

And voilà, Spotlight found it. Not the best solution, but the best I found.

enter image description here

share|improve this answer
1  
You can use the Kind:"Safari bookmark" to restrict spotlight, but the reading list is just another folder of bookmarks with some extra UI interface to render the saved favicon and a bit more of the content. –  bmike Mar 2 '12 at 15:54
    
This is great. Not perfect as I can't easily integrate with Alfred - but better than nothing. –  Matty Mar 5 '12 at 17:34
    
@Matty The bookmarks are saved as .webhistory files in ~/Library/Caches/Metadata/Safari/History. Try to add this folder to your search scope in Alfred Preferences > Features. –  gentmatt Mar 5 '12 at 17:48
    
I thought so too, but discovered the reading list survives clearing out the History cache. That led to me to find that the list of bookmarks in the reading list and the preview text for each is actually in ~/Library/Safari/Bookmarks.plist. See my script below. –  applehelpwriter Apr 9 '13 at 6:22

Create an AppleScript .scpt or Automator Service workflow and assign it a shortcut key.

The following script opens your default editor's window with the search results. A bit kludgy, and if the search string is in the Preview field but isn't in the URL you'll get back the line from the Preview field but not the URL. Might be possible to code round that with awk, but I haven't got round to figuring it out yet. Otherwise it works quite well.

--AppleScript
display dialog ("Enter the string to search for: ") default answer "Search Safari Reading List" buttons {"Cancel", "Search"} default button 2

set searchTerm to the text returned of the result


do shell script "strings ~/Library/Safari/Bookmarks.plist | grep -i '" & searchTerm & "' | awk '{ print FNR \"t\" $0}' | open -f"

--EOF

(Note: you need to scroll right to see the end of the final line. From 'do shell script.... to ....open -f" ' is all ONE line).


You should see something like this after hitting "Search" (obviously your results will differ from mine!)

Search Safari Reader

share|improve this answer
    
This would search just the URLs: defaults read ~/Library/Safari/Bookmarks.plist | sed -En 's/.*URLString = "(.*)";/\1/p' | grep -F "$searchTerm" –  Lri Apr 9 '13 at 12:35
    
Thanks, but restricting the search to the URLs isn't the problem. That can be done easily enough by modifying the grep command I already have. But that makes the search less powerful, which is not what we want. The issue is how to return the URL on the preceding line when the search term is only in the preview snippet. –  applehelpwriter Apr 9 '13 at 16:14
1  
Maybe something like /usr/libexec/PlistBuddy -c print ~/Library/Safari/Bookmarks.plist | sed -En 's/^ *(URLString|PreviewText) = (.*)/\2/p' | paste - - | grep -Ei searchphrase | cut -f1. PlistBuddy prints non-ASCII characters as literal characters instead of escape sequences. –  Lri Apr 10 '13 at 7:53
    
This is getting there, thanks Lauri. It still doesn't quite return accurate results, but I may be able to tinker with it. I'm not quite familiar with the 'paste' pipe (just going to man page that now... :) ), the rest of it I get. It's a useful start. Thanks, again. –  applehelpwriter Apr 10 '13 at 11:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.