Skip to content

Instantly share code, notes, and snippets.

@morygonzalez
Forked from siyo/rt_rt_filter.rb
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morygonzalez/6601afbd904e64a02eec to your computer and use it in GitHub Desktop.
Save morygonzalez/6601afbd904e64a02eec to your computer and use it in GitHub Desktop.
多段非公式RTフィルタ earthquake.gem plugin (invalid byte sequence in UTF-8 (ArgumentError) 対応版)
# -*- coding: utf-8 -*-
require 'utf8-cleaner'
Earthquake.init do
output_filter do |item|
next if item.nil? || item["text"].nil?
str = UTF8Cleaner::URIString.new(item["text"]).cleaned
!(/^.+[¥"QR]T(?:[:\s]*@[A-Za-z0-9_]|\(via[:\s]*@[A-Za-z0-9_]).+[¥"QR]T/ =~ str)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment