mirror of
https://github.com/hmaxnl/SharpRSS.git
synced 2024-09-20 01:54:20 +02:00
53 lines
1.3 KiB
C#
53 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using CodeHollow.FeedReader;
|
|
using SharpRss.Models;
|
|
|
|
namespace SharpRss
|
|
{
|
|
/// <summary>
|
|
/// Managing RSS feeds and categories.
|
|
/// </summary>
|
|
public class RssService
|
|
{
|
|
public RssService()
|
|
{
|
|
/// Storage options:
|
|
/// - Database
|
|
/// - File
|
|
/// - Memory
|
|
}
|
|
|
|
public async Task<HashSet<CategoryModel>> GetCategories()
|
|
{
|
|
return new HashSet<CategoryModel>();
|
|
}
|
|
|
|
public async Task<HashSet<FeedModel>> GetAllFeeds()
|
|
{
|
|
return new HashSet<FeedModel>();
|
|
}
|
|
|
|
|
|
/// Old
|
|
|
|
public async Task<Feed> GetFeed(string feedUrl)
|
|
{
|
|
var urls = await FeedReader.GetFeedUrlsFromUrlAsync(feedUrl);
|
|
string url;
|
|
if (urls.Count() < 1)
|
|
url = _feeds[0];
|
|
else
|
|
url = urls.First().Url;
|
|
|
|
return await FeedReader.ReadAsync(url);
|
|
}
|
|
public async Task<HashSet<Feed>> GetFeedsFromCatAsync(CategoryModel category)
|
|
{
|
|
return new HashSet<Feed>();
|
|
}
|
|
|
|
private readonly string[] _feeds = { "https://www.reddit.com/r/freshrss/.rss", "http://fedoramagazine.org/" };
|
|
}
|
|
} |