protected override void MyInit(params string[] arguments)
        {
            AddStartUrl("http://a.com");
            Downloader = new MyDownloader();
            var process = new EntityProcessor <MyEntity>(new MyExtractor());

            AddPageProcessors(process);
        }
Exemplo n.º 2
0
    public void UserClicksDownload()
    {
        md = new MyDownloader();
        Thread t = new Thread(md.DownloadStuff);

        t.Start();

        Thread.Sleep(100);
    }
Exemplo n.º 3
0
        protected override void MyInit(params string[] arguments)
        {
            SkipTargetUrlsWhenResultIsEmpty = false;

            AddStartUrl("http://a.com");

            Downloader = new MyDownloader();
            var process = new EntityProcessor <MyEntity>(new MyExtractor());

            AddPageProcessor(process);
        }
Exemplo n.º 4
0
        private async Task Run()
        {
            UserCredential credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
                new ClientSecrets
            {
                ClientId     = "289545511724-6dquu1ilvodbskkep1t8lpsa58cc6v1c.apps.googleusercontent.com",
                ClientSecret = "YDXnTH5Tv2uqB9F4LM70qBHG"
            },
                new[] { BooksService.Scope.Books, },
                "user",
                CancellationToken.None,
                new FileDataStore("Books.ListMyLibrary"));

            var baseClientInit = new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName       = "Test CLI app",
                ApiKey = "AIzaSyDP_XISzAyHy5I0t_VRTz6ajBHWi0v9J9Q"
            };

            // Create the service.
            var booksService = new BooksService(baseClientInit);

            var listMyBooks = await booksService.Volumes.Useruploaded.List().ExecuteAsync();

            foreach (var(book, index) in listMyBooks.Items.WithIndex())
            {
                Console.WriteLine(index + " " + book.VolumeInfo.Title);
                if (book.AccessInfo.Epub != null)
                {
                    Console.WriteLine("EPUB:");
                    Console.WriteLine(book.AccessInfo.Epub.DownloadLink);
                }

                if (book.AccessInfo.Pdf != null)
                {
                    Console.WriteLine("PDF:");
                    Console.WriteLine(book.AccessInfo.Pdf.DownloadLink);
                }
            }

            var selection      = int.Parse(Console.ReadLine());
            var selectedVolume = listMyBooks.Items[selection];

            var token = await credential.GetAccessTokenForRequestAsync();

            var response = MyDownloader.MyDownload(selectedVolume, token);
            var name     = selectedVolume.VolumeInfo.Title.RemoveFilenameInvalidChars() + ".epub";

            File.Delete(name);
            var stream = new FileStream(name, FileMode.CreateNew);

            stream.Write(response.RawBytes);
        }
Exemplo n.º 5
0
 void manager_DownloadEnded(object sender, MyDownloader.Core.DownloaderEventArgs e)
 {
     if (parameters.CheckFileWithAV)
     {
         string fileExtension = Path.GetExtension(e.Downloader.LocalFile).ToUpper();
         string[] extensionsToCheck = parameters.FileTypes.ToUpper().Split(';');
         int index = Array.IndexOf(extensionsToCheck, fileExtension);
         if (index >= 0)
         {
             Process.Start(parameters.AVFileName,
                 String.Format(
                     "{0} {1}",
                     parameters.AVParameter,
                     e.Downloader.LocalFile));
         }
     }
 }