Exemplo n.º 1
0
        public DanbooruRetrieval(String url)
        {
            url = url.ToLower();
            //Check that it's Danbooru, just in case some f****t called us on something else
            if (!url.Contains("danbooru.donmai.us"))
            {
                throw new BooruRetrievalFailedException(BooruRetrievalFailedException.errCode.InvalidURL);
            }

            //Get the image URL
            String imageURL = retrieveImageURL(url);

            //Get the image
            Image = retrieveImage(imageURL);

            //Get the source
            ISauce sriracha;

            try
            {
                sriracha = new SauceNao(imageURL);
            }
            catch (Exception sEx)
            {
                throw new BooruRetrievalFailedException(BooruRetrievalFailedException.errCode.SauceFailed, sEx);
            }

            //Get the title and sauce url from the ISauce
            Title    = sriracha.getTitle();
            SauceURL = sriracha.getSauceURL();
        }
Exemplo n.º 2
0
        public FileRetrieval(string url)
        {
            Image = retrieveImage(url);
            ISauce sauce = new SauceNao(url);

            SauceURL = sauce.getSauceURL();
            Title    = sauce.getTitle();
        }
Exemplo n.º 3
0
        public SafebooruRetrieval(String url)
        {
            //Check that the URL is safebooru.org
            url.ToLower();
            if (!url.Contains("safebooru.org"))
            {
                throw new BooruRetrievalFailedException(BooruRetrievalFailedException.errCode.InvalidURL);
            }

            //Get the url of the image
            String imageURL = retrieveImageURL(url);

            //Get the image
            Image = retrieveImage(imageURL);

            //Get the ISauce
            ISauce sriracha = new SauceNao(imageURL);

            //Dip stuff into the ISauce
            SrcURL = sriracha.getSauceURL();
            Title  = sriracha.getTitle();
        }