Get The URLs and Names For Open Safari Tabs With AppleScript

Paste this into the Script Editor app and run it as AppleScript to get the title and URL for all your open tabs in safari. It uses ~~~ as a separator. Using an actual tab character might work, but your milage may vary. (Commas are ill advised since they are a valid URL character)

tell application "Safari"
	set tabList to ""
	set numberOfWindows to count (every window where visible is true)
	repeat with windowNumber from 1 to numberOfWindows
		set numberOfTabs to number of tabs in window windowNumber
		repeat with tabNumber from 1 to numberOfTabs
			set tabName to name of tab tabNumber of window windowNumber
			set tabURL to URL of tab tabNumber of window windowNumber as string
			set tabList to tabList & tabName & "~~~" & tabURL & linefeed as string
		end repeat
	end repeat
end tell

return tabList

This is what I used to capture my browsing history each day while I was using Safari. Chrome is gonna take some more work.

I found the core of this script on another site, but I'm not sure where. If I find it, I'll update this with a link.