private static IEnumerable<TwitterStatusBase> GetMyTweets(AccountInfo info) { if (info.NumericId != 0) return UnfoldTimeline(i => info.GetUserTimeline(userId: info.NumericId, count: TwitterDefine.HomeReceiveMaxCount, includeRts: true, page: i), TwitterDefine.HomeReceiveMaxCount * 2 / 3, 5); else return UnfoldTimeline(i => info.GetUserTimeline(screenName: info.ScreenName, count: TwitterDefine.HomeReceiveMaxCount, includeRts: true, page: i), TwitterDefine.HomeReceiveMaxCount * 2 / 3, 5); }
private static void AddUnderControlled(AccountInfo info) { if (underControls.ContainsKey(info)) { NotifyStorage.Notify("[規制管理: @" + info.ScreenName + " は規制されています。解除予想時刻: " + underControls[info].ToString("HH:mm:ss")); return; } var timestamp = DateTime.Now.Subtract(TwitterDefine.UnderControlTimespan); // APIを利用してツイートを遡り受信 var notify = NotifyStorage.NotifyManually("[規制管理: @" + info.ScreenName + " の直近のツイートを受信しています...]"); try { ApiHelper.ExecApi(() => info.GetUserTimeline(count: 150, includeRts: true)) .Guard() .ForEach(i => TweetStorage.Register(i)); notify.Message = "[規制管理:規制開始時刻を割り出しています...]"; // 127tweet/3hours var originate = TweetStorage.GetAll( t => t.Status.User.ScreenName == info.ScreenName && DateTime.Now.Subtract(t.CreatedAt) < TwitterDefine.UnderControlTimespan) .OrderByDescending((t) => t.Status.CreatedAt) .Skip(TwitterDefine.UnderControlCount - 1) .FirstOrDefault(); if (originate == null) { originate = TweetStorage.GetAll( t => t.Status.User.ScreenName == info.ScreenName && DateTime.Now.Subtract(t.CreatedAt) < TwitterDefine.UnderControlTimespan) .OrderByDescending((t) => t.Status.CreatedAt) .LastOrDefault(); } if (originate == null) { NotifyStorage.Notify("[規制管理: @" + info.ScreenName + " はPOST規制されていますが、解除時刻を予想できません。しばらく置いて試してみてください。]"); } else { var release = (originate.Status.CreatedAt + TwitterDefine.UnderControlTimespan); NotifyStorage.Notify("[規制管理: @" + info.ScreenName + " はPOST規制されています。解除予想時刻は " + release.ToString("HH:mm:ss") + " です。]"); underControls.AddOrUpdate(info, release); OnOnUnderControlChanged(new UnderControlEventArgs(info, true)); } } finally { notify.Dispose(); } }
private static IEnumerable<TwitterStatusBase> GetMyTweets(AccountInfo info) { return ApiHelper.ExecApi(() => info.GetUserTimeline(screenName: info.ScreenName, count: TwitterDefine.HomeReceiveMaxCount, includeRts: true)); }