Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.98 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.IO;
  11. using xNet;
  12. using System.Threading;
  13. using System.Threading.Tasks;
  14.  
  15. namespace AlexaRankParser
  16. {
  17.     public partial class Form1 : Form
  18.     {
  19.         OpenFileDialog filename = new OpenFileDialog();
  20.         SaveFileDialog savefilename = new SaveFileDialog();
  21.  
  22.         public Form1()
  23.         {
  24.             InitializeComponent();
  25.         }
  26.  
  27.         private void button1_Click(object sender, EventArgs e)
  28.         {
  29.  
  30.             CancellationTokenSource cts = new CancellationTokenSource();
  31.  
  32.             var opt = new ParallelOptions
  33.             {
  34.                 CancellationToken = cts.Token,
  35.                 MaxDegreeOfParallelism = potoki
  36.             };
  37.             Parallel.ForEach(lines, opt, a => Send(a));
  38.  
  39.  
  40.  
  41.             savefilename.ShowDialog();
  42.  
  43.             using (var request = new HttpRequest())
  44.             {
  45.  
  46.  
  47.                 var useraGENT = Http.ChromeUserAgent();
  48.  
  49.                
  50.              
  51.                 string[] baza = File.ReadAllLines(filename.FileName, Encoding.Default);
  52.  
  53.  
  54.                 HttpResponse result;
  55.                 foreach (var m in baza)
  56.                 {
  57.                     result = request.Get("http://data.alexa.com/data?cli=10&dat=s&url=" + m);
  58.  
  59.  
  60.                     var URL = result.ToString();
  61.  
  62.                     int startIndex = result.ToString().IndexOf("<SD>");
  63.                     int endIndex = result.ToString().LastIndexOf("/<SD>");
  64.                     int length = endIndex - startIndex + 1;
  65.  
  66.                  
  67.                ///    File.AppendAllLines(savefilename.FileName, key);
  68.  
  69.                 }
  70.            
  71.             }
  72.  
  73.         }
  74.  
  75.         private void button2_Click(object sender, EventArgs e)
  76.         {
  77.             filename.ShowDialog();
  78.         }
  79.     }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement