Mercurial > rsstweet
view app/helpers/application_helper.rb @ 240:c454ea4f7b34 legit-client
Add support for note tweets (with no formatting)
author | nanaya <me@nanaya.net> |
---|---|
date | Sat, 15 Jul 2023 03:24:56 +0900 |
parents | 7a773720d81f |
children | 3ac13a9e593d |
line wrap: on
line source
module ApplicationHelper include Twitter::TwitterText::Autolink def atom_id(id) "tag:rsstweet@nanaya.pro,2014:#{id}" end def expand_url(text, urls) text.gsub /https?:\/\/t\.co\/[A-Za-z0-9]+/ do |url| urls[url] || url end end def status_url(tweet) status_url_base tweet[:user][:username], tweet[:id] end def status_url_base(username, id) "https://twitter.com/#{username.presence || '_'}/status/#{id}" end end