posts: fix exception when post has source like 'https://www.twitter.com/username'.

`twitter.com` sources worked but `www.twitter.com` didn't.

Also match the URL by class instead of by site name to ensure we match
the expected class.
This commit is contained in:
evazion
2022-03-20 20:43:22 -05:00
parent 1ad0e8688d
commit 7394660ba9
9 changed files with 10 additions and 8 deletions

View File

@@ -29,7 +29,8 @@ class Source::URL::Twitter < Source::URL
attr_reader :status_id, :twitter_username, :user_id
def self.match?(url)
url.host.in?(%w[twitter.com mobile.twitter.com pic.twitter.com pbs.twimg.com video.twimg.com t.co])
return false if Source::URL::TwitPic.match?(url) # TwitPic uses https://o.twimg.com/ URLs
url.domain.in?(%w[twitter.com twimg.com t.co])
end
def parse