Hey Mitchell,
Not exactly a small brush, but a configurable one.
This script sends the Safari page source to BBEdit.
You can use similar techniques to search for favicons in the code.
---------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2010/11/13 21:15
# dMod: 2015/12/05 10:43
# Appl: Safari & BBEdit
# Task: Open source of front Safari window in a new BBEdit window.
# Libs: None
# Osax: None
# Tags: @Applescript, @Get, @Safari, @Source, @Generated
---------------------------------------------------------------------------------
--» MAIN
---------------------------------------------------------------------------------
try
tell application "Safari"
tell front document
set {_name, _src} to {name, do JavaScript "document.body.parentNode.outerHTML"}
end tell
end tell
tell application "BBEdit"
make new text document with properties ¬
{contents:_src, source language:"HTML", name:"genSrc: " & _name, bounds:my desktopBounds(), soft wrap text:false}
tell front text window to select insertion point before character 1
activate
end tell
on error e number n
stdErr(e, n, true, true) of me
end try
---------------------------------------------------------------------------------
--» HANDLERS
---------------------------------------------------------------------------------
--» deskTopBounds()
-- Task: Get bounds of Finder's Desktop Window
-- dMod: 2011/09/25 01:01
---------------------------------------------------------------------------------
on desktopBounds()
tell application "Finder"
set _bounds to bounds of window of desktop
set item 2 of _bounds to 44
return _bounds
end tell
end desktopBounds
---------------------------------------------------------------------------------
--» stdErr()
---------------------------------------------------------------------------------
-- Task: General error handler
-- dMod: 2013/05/31 04:22
---------------------------------------------------------------------------------
on stdErr(e, n, beepFlag, ddFlg)
set e to e & return & return & "Num: " & n
if beepFlag = true then
beep
end if
if ddFlg = true then
tell me
set dDlg to display dialog e with title "ERROR!" buttons {"Cancel", "Copy", "OK"} default button "OK"
end tell
if button returned of dDlg = "Copy" then set the clipboard to e
else
return e
end if
end stdErr
---------------------------------------------------------------------------------
This script requires the Satimage.osax AppleScript Extension. to be installed. It will return a list of any found favicon URLs.
---------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2016/06/08 05:43
# dMod: 2016/06/08 05:43
# Appl: Safari
# Task: Find favicon URL(s) in the source of Safari's front page.
# Libs: None
# Osax: Satimage.osax { http://tinyurl.com/dc3soh }
# Tags: @Applescript, @Script, @Safari, @Find, @Favicon @URL
---------------------------------------------------------------------------------
tell application "Safari"
tell front document to set pageSource to do JavaScript "document.body.parentNode.outerHTML"
end tell
set faviconList to fnd("href *= *(?>(?!href).)+favicon[^'\"]+", pageSource, true, true) of me
if faviconList ≠ {} then
# Do something
end if
---------------------------------------------------------------------------------
--» HANDLERS
---------------------------------------------------------------------------------
on fnd(_find, _data, _all, strRslt)
try
find text _find in _data all occurrences _all string result strRslt with regexp without case sensitive
on error
return false
end try
end fnd
---------------------------------------------------------------------------------
Since BBEdit runs 24/7 on my system I’d probably output any found items to it.
-Chris