Skip to content
Permalink
Browse files

fix twitter link for excerpt

  • Loading branch information...
umputun committed Dec 21, 2016
1 parent c332bb0 commit 51de8825da9d9a45c9da4f991ec89befdb3cf1fc
Showing with 5 additions and 1 deletion.
  1. +4 −1 excerpt-bot/main.go
  2. +1 −0 excerpt-bot/main_test.go
@@ -127,9 +127,12 @@ func excerpt(link string) (result string, err error) {
}

func link(input string) (link string, err error) {
if strings.Contains(link, "twitter.com") {

if strings.Contains(input, "twitter.com") {
log.Printf("ignore possible twitter link from %s", input)
return "", errors.New("ignore twitter")
}

if link := rLink.FindString(input); link != "" && !rImg.MatchString(link) {
log.Printf("found a link %s", link)
return link, nil
@@ -15,6 +15,7 @@ func TestLink(t *testing.T) {
{"blah http://radio-t.com/aa.gif blah2", "", true},
{"blah https://radio-t.com/aa.png blah2", "", true},
{"blah https://radio-t.com/png blah2", "https://radio-t.com/png", false},
{"blah https://twitter.com/radio_t/status/811670832510537730", "", true},
}

for _, tt := range tbl {

0 comments on commit 51de882

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.