Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WebClient wc = new WebClient();
- var dialog = new OpenFileDialog();
- var result = dialog.ShowDialog();
- List<string> qas = File.ReadAllLines(dialog.FileName).ToList();
- int count = qas.Count();
- string init = " <a href=\"";
- for (int cont = 0; cont < count; cont++)
- {
- bool s = false;
- List<string> html_lines = new List<string>();
- do
- {
- try
- {
- html_lines = wc.DownloadString(qas[cont]).Split('\n').ToList();
- s = true;
- }
- catch { }
- } while (s == false);
- bool initialize = false;
- foreach (string line in html_lines)
- {
- if (line.Contains("privacy-policy"))
- {
- initialize = false;
- }
- else if (line.Contains("Similar Asks"))
- {
- initialize = true;
- }
- else if(line.Contains("Popular Asks"))
- {
- initialize = false;
- }
- if (initialize == true)
- {
- if (line.Contains(init))
- {
- string url = line.Substring(init.Length, line.IndexOf("\">") - init.Length);
- if (!qas.Contains(url))
- {
- qas.Add(url);
- File.AppendAllText(@"C:\Users\" + SystemInformation.UserName + @"\Desktop\qas\qas.txt", url + '\n');
- }
- }
- }
- }
- count = qas.Count();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement