示例#1
0
        public WebToIrc()
        {
            Chan  = new ChanHandler();
            Danbo = new DanboHandler();
            Gelbo = new GelboHandler();
            Wiki  = new WikipediaHandler();

            urlFetcher = new WebUriFetcher()
            {
                Cookies        = new CookieContainer(),
                MaxSizeNonHtml = SizeConstants.NonHtmlDefault
            };

            preHtmlHandlers = new Func <TitlingRequest, TitlingResult>[] {
                Danbo.HandleRequest,
                Gelbo.HandleRequest,
                Chan.HandleRequest
            };

            // Generic instructions, for all URLs not matched by
            // previous instructions.
            var generic = new UrlLoadInstructions(
                uri => true,
                SizeConstants.HtmlDefault,
                true,
                GenericHandler
                );

            urlInstructions = new UrlLoadInstructions[] {
                UrlLoadInstructions.Youtube,
                UrlLoadInstructions.Twitter,
                Wiki.LoadInstructions,
                generic
            };
        }
示例#2
0
 public WikipediaHandler()
 {
     LoadInstructions = new UrlLoadInstructions(
         uri => uri.Host.EndsWith("wikipedia.org", StringComparison.OrdinalIgnoreCase),
         SizeConstants.Wikipedia,
         WikipediaSummarize
         );
 }
示例#3
0
        static UrlLoadInstructions()
        {
            Twitter = new UrlLoadInstructions(
                uri => uri.Host.Equals("twitter.com", StringComparison.OrdinalIgnoreCase),
                SizeConstants.Twitter,
                (req, html) => req.CreateResult(true)
                );

            Youtube = new UrlLoadInstructions(
                uri =>
                uri.Host.Equals("www.youtube.com", StringComparison.OrdinalIgnoreCase) ||
                uri.Host.Equals("youtu.be", StringComparison.OrdinalIgnoreCase),
                SizeConstants.Youtube,
                MiscHandlers.YoutubeWithDuration
                );
        }