return Twitter.StatusUrlRegex.Matches(url).Cast<Match>()
.Select(x => x.Groups["StatusId"].Value).ToArray();
}
+
+ [TestCase("http://favstar.fm/users/twitterapi/status/22634515958",
+ Result = new[] { "22634515958" })]
+ [TestCase("http://ja.favstar.fm/users/twitterapi/status/22634515958",
+ Result = new[] { "22634515958" })]
+ [TestCase("http://favstar.fm/t/22634515958",
+ Result = new[] { "22634515958" })]
+ [TestCase("http://aclog.koba789.com/i/312485321239564288",
+ Result = new[] { "312485321239564288" })]
+ [TestCase("http://frtrt.net/solo_status.php?status=263483634307198977",
+ Result = new[] { "263483634307198977" })]
+ public string[] ThirdPartyStatusUrlRegexTest(string url)
+ {
+ return Twitter.ThirdPartyStatusUrlRegex.Matches(url).Cast<Match>()
+ .Select(x => x.Groups["StatusId"].Value).ToArray();
+ }
}
}
==== Ver 1.1.0-beta1(2013/xx/xx)
* NEW: タブの表示位置を画面上部に変更可能に (thx @aokomoriuta!)
* NEW: mobile.twitter.com/<スクリーン名>/status/<ステータスID> のURLも関連発言表示の対象に追加
+ * NEW: Favstarなどサードパーティ製サービスのパーマリンクURLも関連発言表示の対象に追加
* FIX: スペースが含まれているURLをブラウザで開こうとするとURLが分断されて複数のタブが開いてしまう問題を修正 (thx @5px!)
* FIX: 画面更新時にInvalidOperationExceptionのエラーが発生する不具合を修正
/// </summary>
public static readonly Regex StatusUrlRegex = new Regex(@"https?://([^.]+\.)?twitter\.com/(#!/)?(?<ScreenName>[a-zA-Z0-9_]+)/status(es)?/(?<StatusId>[0-9]+)(/photo)?", RegexOptions.IgnoreCase);
+ /// <summary>
+ /// FavstarやaclogなどTwitter関連サービスのパーマリンクURLからステータスIDを抽出する正規表現
+ /// </summary>
+ public static readonly Regex ThirdPartyStatusUrlRegex = new Regex(@"https?://(?:[^.]+\.)?(?:
+ favstar\.fm/users/[a-zA-Z0-9_]+/status/ # Favstar
+| favstar\.fm/t/ # Favstar (short)
+| aclog\.koba789\.com/i/ # aclog
+| frtrt\.net/solo_status\.php\?status= # RtRT
+)(?<StatusId>[0-9]+)", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
+
delegate void GetIconImageDelegate(PostClass post);
private readonly object LockObj = new object();
private List<long> followerId = new List<long>();
//return rslt;
//MRTとかに対応のためツイート内にあるツイートを指すURLを取り込む
- var ma = Twitter.StatusUrlRegex.Matches(tab.RelationTargetPost.Text);
- foreach (Match _match in ma)
+ var text = tab.RelationTargetPost.Text;
+ var ma = Twitter.StatusUrlRegex.Matches(text).Cast<Match>()
+ .Concat(Twitter.ThirdPartyStatusUrlRegex.Matches(text).Cast<Match>());
+ foreach (var _match in ma)
{
Int64 _statusId;
if (Int64.TryParse(_match.Groups["StatusId"].Value, out _statusId))