public async Task <NiconicoVideoRss> GetCategoryRanking(RankingCategory category, RankingTarget target, RankingTimeSpan timeSpan) { return(await ContextActionAsync(async context => { return await NiconicoRanking.GetRankingData(target, timeSpan, category); })); }
public async Task <NiconicoVideoRss> GetCategoryRanking(RankingCategory category, RankingTarget target, RankingTimeSpan timeSpan) { return(await ConnectionRetryUtil.TaskWithRetry(async() => { return await NiconicoRanking.GetRankingData(target, timeSpan, category); })); }
public async Task RankingHotTopicGettingTestAsync(RankingTerm term, int page) { var data = await NiconicoRanking.GetRankingRssAsync(RankingGenre.HotTopic, term : term, page : page); Assert.IsTrue(data.IsOK); Assert.IsTrue(data.Items.Any()); var sampleItems = data.Items.Take(1).ToArray(); foreach (var sampleItem in sampleItems) { var videoid = sampleItem.GetVideoId(); Assert.IsTrue(videoid.StartsWith("sm") || videoid.StartsWith("so") || videoid.StartsWith("nm")); System.Diagnostics.Debug.WriteLine(videoid); var title = sampleItem.GetRankTrimmingTitle(); System.Diagnostics.Debug.WriteLine(title); var moreData = sampleItem.GetMoreData(); Assert.IsNotNull(moreData.Title); Assert.IsTrue(moreData.Length > TimeSpan.Zero); Assert.IsTrue(moreData.WatchCount >= 0); Assert.IsTrue(moreData.CommentCount >= 0); Assert.IsTrue(moreData.MylistCount >= 0); } }
public async Task <List <Database.Local.RankingGenreTag> > GetRankingGenreTagsAsync(RankingGenre genre, bool isForceUpdate = false) { if (isForceUpdate) { Database.Local.RankingGenreTagsDb.Delete(genre); } else { var cachedTags = Database.Local.RankingGenreTagsDb.Get(genre); if (cachedTags != null && (DateTime.Now - cachedTags.UpdateAt) < TimeSpan.FromHours(6)) { return(cachedTags.Tags); } } var tagsRaw = await NiconicoRanking.GetGenrePickedTagAsync(genre); var tags = tagsRaw.Select(x => new Database.Local.RankingGenreTag() { DisplayName = x.DisplayName, Tag = x.Tag }).ToList(); Database.Local.RankingGenreTagsDb.Upsert(genre, tags); return(tags); }
public async Task RankingHotTopicTagsGettingsAsync() { var tags = await NiconicoRanking.GetGenrePickedTagAsync(RankingGenre.HotTopic); foreach (var tag in tags) { Assert.IsNotNull(tag); if (tag.IsDefaultTag) { System.Diagnostics.Debug.WriteLine("Default tag: " + tag.DisplayName); Assert.IsNotNull(tag.DisplayName); } else { System.Diagnostics.Debug.WriteLine($"{tag.DisplayName}"); System.Diagnostics.Debug.WriteLine($"{tag.Tag}"); Assert.IsNotNull(tag.DisplayName); Assert.IsNotNull(tag.Tag); } } }
protected override async Task <int> HohoemaPreloadingResetSourceImpl() { RankingRss = await NiconicoRanking.GetRankingData(_Target, _TimeSpan, _Category); return(RankingRss.Channel.Items.Count); }
public async Task RankingHotTopicFailTestAsync(RankingTerm term, int page) { await Assert.ThrowsExceptionAsync <ArgumentOutOfRangeException>(async() => await NiconicoRanking.GetRankingRssAsync(RankingGenre.HotTopic, term: term, page: page) ); }
protected override async Task <int> ResetSourceImpl() { RankingRss = await NiconicoRanking.GetRankingData(Target, TimeSpan, Category); return(RankingRss.Channel.Items.Count); }
public async Task <Mntone.Nico2.RssVideoResponse> GetRankingGenreWithTagAsync(RankingGenre genre, string tag, RankingTerm term, int page = 1) { return(await NiconicoRanking.GetRankingRssAsync(genre, tag, term, page)); }