Advertisement
Guest User

findanyanswer.com similar searcher

a guest
Dec 30th, 2020
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. WebClient wc = new WebClient();
  2. var dialog = new OpenFileDialog();
  3. var result = dialog.ShowDialog();
  4.  
  5. List<string> qas = File.ReadAllLines(dialog.FileName).ToList();
  6.  
  7. int count = qas.Count();
  8.  
  9. string init = " <a href=\"";
  10.  
  11. for (int cont = 0; cont < count; cont++)
  12. {
  13. bool s = false;
  14. List<string> html_lines = new List<string>();
  15. do
  16. {
  17. try
  18. {
  19. html_lines = wc.DownloadString(qas[cont]).Split('\n').ToList();
  20. s = true;
  21. }
  22. catch { }
  23. } while (s == false);
  24. bool initialize = false;
  25.  
  26. foreach (string line in html_lines)
  27. {
  28. if (line.Contains("privacy-policy"))
  29. {
  30. initialize = false;
  31. }
  32. else if (line.Contains("Similar Asks"))
  33. {
  34. initialize = true;
  35. }
  36. else if(line.Contains("Popular Asks"))
  37. {
  38. initialize = false;
  39. }
  40.  
  41. if (initialize == true)
  42. {
  43.  
  44. if (line.Contains(init))
  45. {
  46. string url = line.Substring(init.Length, line.IndexOf("\">") - init.Length);
  47. if (!qas.Contains(url))
  48. {
  49. qas.Add(url);
  50. File.AppendAllText(@"C:\Users\" + SystemInformation.UserName + @"\Desktop\qas\qas.txt", url + '\n');
  51. }
  52. }
  53. }
  54. }
  55.  
  56. count = qas.Count();
  57. }
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement