diff options
author | mms <git@sapka.me> | 2024-12-03 21:54:54 +0100 |
---|---|---|
committer | mms <git@sapka.me> | 2024-12-03 21:54:54 +0100 |
commit | deac28735f843aa4a2bcab309b343caa2bfffbb1 (patch) | |
tree | e9ac45e0c59e64a2bf56affb5203cb8c1aed54c9 /bin | |
parent | 1fa238ef9c2044b28853b49f347bd8afd0683c2d (diff) |
links
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/bookmark | 9 |
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 |