Skip to content

Commit

Permalink
patch: 修正の確認パッチ
Browse files Browse the repository at this point in the history
  • Loading branch information
yamadashy committed Aug 24, 2024
1 parent b2ed48a commit fd9a01a
Showing 1 changed file with 5 additions and 30 deletions.
35 changes: 5 additions & 30 deletions src/resources/feed-info-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,12 @@ const createFeedInfoList = (feedInfoTuples: FeedInfoTuple[]) => {
};

export const fetchFeedInfoList = async (): Promise<FeedInfo[]> => {
interface FeedItem {
url: string;
feeds: ValidUrl[];
}
// RSSの一覧を取得
const response = await fetch('https://jser.info/watch-list/data/opml-list.json');
const feedInfoList: FeedItem[] = await response.json();
// 特定のドメインは除外する
const ExcludedDomains = [
// beta的なリリースが埋まりやすいため
'github.com',
// https://github.com/jser/watch-list-rss/issues/1
'www.aha.io',
];
// フィードの重複を取り除く
const tmpUsedDomainSet = new Set<string>();
const feedInfoListWithoutDomains = feedInfoList.filter((feedItem) => {
const feedUrl = feedItem.feeds[0];
if (!feedUrl) {
return false;
return [
{
label: 'https://www.aha.io/blog/feed.xml',
url: 'https://www.aha.io/blog/feed.xml',
}
const feedHostname = new URL(feedItem.feeds[0]).hostname;
if (tmpUsedDomainSet.has(feedHostname) || tmpUsedDomainSet.has(feedUrl)) {
return false;
}
tmpUsedDomainSet.add(feedHostname);
tmpUsedDomainSet.add(feedUrl);
// remove duplicate domain
return !ExcludedDomains.includes(feedHostname);
});
return createFeedInfoList(feedInfoListWithoutDomains.map((feedItem) => [feedItem.url, feedItem.feeds[0]]));
];
};

/**
Expand Down

0 comments on commit fd9a01a

Please sign in to comment.