forked from nilaoda/BBDown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FetcherFactory.cs
49 lines (47 loc) · 1.41 KB
/
FetcherFactory.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using BBDown.Core.Fetcher;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BBDown.Core
{
public sealed class FetcherFactory
{
private FetcherFactory() { }
/// <summary>
/// 根据不同场景获取不同的Info解析器
/// </summary>
/// <param name="aidOri"></param>
/// <returns>IFetcher</returns>
public static IFetcher CreateFetcher(string aidOri, bool useIntlApi)
{
IFetcher fetcher = new NormalInfoFetcher();
if (aidOri.StartsWith("cheese"))
{
fetcher = new CheeseInfoFetcher();
}
else if (aidOri.StartsWith("ep"))
{
fetcher = useIntlApi ? new IntlBangumiInfoFetcher() : new BangumiInfoFetcher();
}
else if (aidOri.StartsWith("mid"))
{
fetcher = new SpaceVideoFetcher();
}
else if (aidOri.StartsWith("listBizId"))
{
fetcher = new MediaListFetcher();
}
else if (aidOri.StartsWith("seriesBizId"))
{
fetcher = new SeriesListFetcher();
}
else if (aidOri.StartsWith("favId"))
{
fetcher = new FavListFetcher();
}
return fetcher;
}
}
}