summaryrefslogtreecommitdiff
path: root/bin/bookmark
diff options
context:
space:
mode:
Diffstat (limited to 'bin/bookmark')
-rwxr-xr-xbin/bookmark9
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/bookmark b/bin/bookmark
index eb22730..6d229ee 100755
--- a/bin/bookmark
+++ b/bin/bookmark
@@ -28,15 +28,18 @@ bookmark.source_host = URI.parse(bookmark[:source_url]).host.gsub(/^www\./, '')
URI.parse(bookmark[:url]).open({ ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE }) do |page|
noko = Nokogiri::HTML(page)
title = noko.xpath('//title').first.content
+ title = title.gsub("\n", " ")
# remove known page title craps
title = case bookmark.host
+ when 'arstechnica.com' then title.gsub(/\s-\sArs Technica$/, '')
+ when 'blog.thechases.com' then title.gsub(/\s\|\sTim's blog$/, '')
when 'brainbaking.com' then title.gsub(/\s\|\sBrain Baking$/, '')
+ when 'freebsd.org' then title.gsub(/\s\|\sThe FreeBSD Project$/, '')
+ when 'servethehome.com' then title.gsub(/\s-\sServeTheHome$/, '')
+ when 'theverge.com' then title.gsub(/\s-\sThe Verge$/, '')
when 'vermaden.wordpress.com' then title.gsub(/\s\|\s𝚟𝚎𝚛𝚖𝚊𝚍𝚎𝚗$/, '')
when 'youtube.com' then title.gsub(/\s-|\sYouTube$/, '')
- when 'blog.thechases.com' then title.gsub(/\s\|\sTim's blog$/, '')
- when 'arstechnica.com' then title.gsub(/\s-\sArs Technica$/, '')
- when 'servethehome.com' then title.gsub(/\s-\sServeTheHome$/, '')
else title
end