Mercurial > rsstweet
view app/helpers/application_helper.rb @ 237:961d362e42c7 legit-client
The url in entity media isn't unique as they all point to the same thing
author | nanaya <me@nanaya.net> |
---|---|
date | Sat, 15 Jul 2023 01:47:34 +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