コード例 #1
0
ファイル: CrawlerFactory.cs プロジェクト: bun-dev/TumblThree
 private TumblrJsonDownloader <T> GetTumblrJsonDownloader <T>(IShellService shellService, CancellationToken ct, PauseToken pt, IPostQueue <TumblrCrawlerData <T> > jsonQueue, ICrawlerService crawlerService, IBlog blog)
 {
     return(new TumblrJsonDownloader <T>(shellService, ct, pt, jsonQueue, crawlerService, blog));
 }
コード例 #2
0
ファイル: CrawlerFactory.cs プロジェクト: bun-dev/TumblThree
 private TumblrDownloader GetTumblrDownloader(CancellationToken ct, PauseToken pt, IProgress <DownloadProgress> progress, IShellService shellService, ICrawlerService crawlerService, IManagerService managerService, IBlog blog, IFiles files, IPostQueue <TumblrPost> postQueue)
 {
     return(new TumblrDownloader(shellService, managerService, ct, pt, progress, postQueue, GetFileDownloader(ct), crawlerService, blog, files));
 }
コード例 #3
0
ファイル: CrawlerFactory.cs プロジェクト: bun-dev/TumblThree
 private TumblrXmlDownloader GetTumblrXmlDownloader(IShellService shellService, CancellationToken ct, PauseToken pt, IPostQueue <TumblrCrawlerData <XDocument> > xmlQueue, ICrawlerService crawlerService, IBlog blog)
 {
     return(new TumblrXmlDownloader(shellService, ct, pt, xmlQueue, crawlerService, blog));
 }
コード例 #4
0
 public TumblrDownloader(IShellService shellService, IManagerService managerService, CancellationToken ct, PauseToken pt, IProgress <DownloadProgress> progress, IPostQueue <TumblrPost> postQueue, FileDownloader fileDownloader, ICrawlerService crawlerService, IBlog blog, IFiles files)
     : base(shellService, managerService, ct, pt, progress, postQueue, fileDownloader, crawlerService, blog, files)
 {
 }
コード例 #5
0
 protected AbstractDownloader(IShellService shellService, IManagerService managerService, CancellationToken ct,
                              PauseToken pt, IProgress <DownloadProgress> progress, IPostQueue <TumblrPost> postQueue, FileDownloader fileDownloader,
                              ICrawlerService crawlerService = null, IBlog blog = null, IFiles files = null)
 {
     this.shellService   = shellService;
     this.crawlerService = crawlerService;
     this.managerService = managerService;
     this.blog           = blog;
     this.files          = files;
     this.ct             = ct;
     this.pt             = pt;
     this.progress       = progress;
     this.postQueue      = postQueue;
     this.fileDownloader = fileDownloader;
 }
コード例 #6
0
 protected AbstractTumblrCrawler(IShellService shellService, ICrawlerService crawlerService, CancellationToken ct,
                                 PauseToken pt, IProgress <DownloadProgress> progress, IWebRequestFactory webRequestFactory,
                                 ISharedCookieService cookieService, ITumblrParser tumblrParser, IImgurParser imgurParser, IGfycatParser gfycatParser,
                                 IWebmshareParser webmshareParser, IMixtapeParser mixtapeParser, IUguuParser uguuParser, ISafeMoeParser safemoeParser,
                                 ILoliSafeParser lolisafeParser, ICatBoxParser catboxParser, IPostQueue <TumblrPost> postQueue, IBlog blog)
     : base(shellService, crawlerService, ct, pt, progress, webRequestFactory, cookieService, postQueue, blog)
 {
     this.tumblrParser    = tumblrParser;
     this.imgurParser     = imgurParser;
     this.gfycatParser    = gfycatParser;
     this.webmshareParser = webmshareParser;
     this.mixtapeParser   = mixtapeParser;
     this.uguuParser      = uguuParser;
     this.safemoeParser   = safemoeParser;
     this.lolisafeParser  = lolisafeParser;
     this.catboxParser    = catboxParser;
 }
コード例 #7
0
 public TumblrSearchCrawler(IShellService shellService, ICrawlerService crawlerService, IWebRequestFactory webRequestFactory,
                            ISharedCookieService cookieService, IDownloader downloader, ICrawlerDataDownloader crawlerDataDownloader, ITumblrParser tumblrParser, IImgurParser imgurParser,
                            IGfycatParser gfycatParser, IWebmshareParser webmshareParser, IMixtapeParser mixtapeParser, IUguuParser uguuParser,
                            ISafeMoeParser safemoeParser, ILoliSafeParser lolisafeParser, ICatBoxParser catboxParser, IPostQueue <TumblrPost> postQueue,
                            IPostQueue <TumblrCrawlerData <Datum> > jsonQueue, IBlog blog, IProgress <DownloadProgress> progress, PauseToken pt, CancellationToken ct)
     : base(shellService, crawlerService, webRequestFactory, cookieService, tumblrParser, imgurParser, gfycatParser,
            webmshareParser, mixtapeParser, uguuParser, safemoeParser, lolisafeParser, catboxParser, postQueue, blog, downloader, progress, pt,
            ct)
 {
     this.downloader            = downloader;
     this.jsonQueue             = jsonQueue;
     this.crawlerDataDownloader = crawlerDataDownloader;
 }
コード例 #8
0
 protected AbstractCrawler(IShellService shellService, CancellationToken ct, IProgress <DownloadProgress> progress, IWebRequestFactory webRequestFactory, ISharedCookieService cookieService, IPostQueue <TumblrPost> postQueue, IBlog blog)
 {
     this.shellService      = shellService;
     this.webRequestFactory = webRequestFactory;
     this.cookieService     = cookieService;
     this.postQueue         = postQueue;
     this.blog     = blog;
     this.ct       = ct;
     this.progress = progress;
 }
コード例 #9
0
 public TwitterCrawler(IShellService shellService, ICrawlerService crawlerService, IProgress <DownloadProgress> progress, IWebRequestFactory webRequestFactory,
                       ISharedCookieService cookieService, IPostQueue <AbstractPost> postQueue, IPostQueue <CrawlerData <Tweet> > jsonQueue, IBlog blog, IDownloader downloader,
                       ICrawlerDataDownloader crawlerDataDownloader, PauseToken pt, CancellationToken ct)
     : base(shellService, crawlerService, progress, webRequestFactory, cookieService, postQueue, blog, downloader, pt, ct)
 {
     this.downloader = downloader;
     this.downloader.ChangeCancellationToken(Ct);
     this.jsonQueue             = jsonQueue;
     this.crawlerDataDownloader = crawlerDataDownloader;
     this.crawlerDataDownloader.ChangeCancellationToken(Ct);
 }
コード例 #10
0
 public ICrawler GetCrawler(IBlog blog, IProgress<DownloadProgress> progress, PauseToken pt, CancellationToken ct)
 {
     IPostQueue<TumblrPost> postQueue = GetProducerConsumerCollection();
     IFiles files = LoadFiles(blog);
     IWebRequestFactory webRequestFactory = GetWebRequestFactory();
     IImgurParser imgurParser = GetImgurParser(webRequestFactory, ct);
     IGfycatParser gfycatParser = GetGfycatParser(webRequestFactory, ct);
     switch (blog.BlogType)
     {
         case BlogTypes.tumblr:
             IPostQueue<TumblrCrawlerData<Post>> jsonApiQueue = GetJsonQueue<Post>();
             return new TumblrBlogCrawler(shellService, crawlerService, webRequestFactory, cookieService,
                 GetTumblrDownloader(progress, blog, files, postQueue, pt, ct), GetTumblrJsonDownloader(jsonApiQueue, blog, pt, ct),
                 GetTumblrApiJsonToTextParser(blog), GetTumblrParser(), imgurParser, gfycatParser, GetWebmshareParser(),
                 GetMixtapeParser(), GetUguuParser(), GetSafeMoeParser(), GetLoliSafeParser(), GetCatBoxParser(), postQueue,
                 jsonApiQueue, blog, progress, pt, ct);
         case BlogTypes.tmblrpriv:
             IPostQueue<TumblrCrawlerData<DataModels.TumblrSvcJson.Post>> jsonSvcQueue =
                 GetJsonQueue<DataModels.TumblrSvcJson.Post>();
             return new TumblrHiddenCrawler(shellService, crawlerService, webRequestFactory,
                 cookieService, GetTumblrDownloader(progress, blog, files, postQueue, pt, ct),
                 GetTumblrJsonDownloader(jsonSvcQueue, blog, pt, ct), GetTumblrSvcJsonToTextParser(blog), GetTumblrParser(),
                 imgurParser, gfycatParser, GetWebmshareParser(), GetMixtapeParser(), GetUguuParser(), GetSafeMoeParser(),
                 GetLoliSafeParser(), GetCatBoxParser(), postQueue, jsonSvcQueue, blog, progress, pt, ct);
         case BlogTypes.tlb:
             return new TumblrLikedByCrawler(shellService, crawlerService, webRequestFactory,
                 cookieService, GetTumblrDownloader(progress, blog, files, postQueue, pt, ct), GetTumblrParser(),
                 imgurParser, gfycatParser, GetWebmshareParser(), GetMixtapeParser(), GetUguuParser(),
                 GetSafeMoeParser(), GetLoliSafeParser(), GetCatBoxParser(), postQueue, blog, progress, pt, ct);
         case BlogTypes.tumblrsearch:
             IPostQueue<TumblrCrawlerData<DataModels.TumblrSearchJson.Datum>> jsonQueue = GetJsonQueue<DataModels.TumblrSearchJson.Datum>();
             return new TumblrSearchCrawler(shellService, crawlerService, webRequestFactory,
                 cookieService, GetTumblrDownloader(progress, blog, files, postQueue, pt, ct), GetTumblrJsonDownloader(jsonQueue, blog, pt, ct),
                 GetTumblrParser(), imgurParser, gfycatParser, GetWebmshareParser(), GetMixtapeParser(), GetUguuParser(),
                 GetSafeMoeParser(), GetLoliSafeParser(), GetCatBoxParser(), postQueue, jsonQueue, blog, progress, pt, ct);
         case BlogTypes.tumblrtagsearch:
             IPostQueue<TumblrCrawlerData<DataModels.TumblrTaggedSearchJson.Datum>> jsonTagSearchQueue =
                 GetJsonQueue<DataModels.TumblrTaggedSearchJson.Datum>();
             return new TumblrTagSearchCrawler(shellService, crawlerService, webRequestFactory,
                 cookieService, GetTumblrDownloader(progress, blog, files, postQueue, pt, ct),
                 GetTumblrJsonDownloader(jsonTagSearchQueue, blog, pt, ct), GetTumblrParser(),
                 imgurParser, gfycatParser, GetWebmshareParser(), GetMixtapeParser(), GetUguuParser(),
                 GetSafeMoeParser(), GetLoliSafeParser(), GetCatBoxParser(), postQueue, jsonTagSearchQueue, blog, progress, pt, ct);
         default:
             throw new ArgumentException("Website is not supported!", nameof(blog));
     }
 }