Guest User

Untitled

a guest
Feb 28th, 2019
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using HtmlAgilityPack;
  7. using System.Net;
  8. using System.IO;
  9. using System.Text.RegularExpressions;
  10. namespace spider
  11. {
  12. class Program
  13. {
  14. static void Main(string[] args)
  15. {
  16. string s;
  17.  
  18. string pattern = @"\w";
  19. WebClient url = new WebClient();
  20.  
  21. MemoryStream ms = new MemoryStream(url.DownloadData("https://translate.google.cn/translate_a/single?client=gtx&sl=zh-TW&tl=en&dt=t&q=我愛你"));
  22. HtmlDocument doc = new HtmlDocument();
  23. doc.Load(ms,Encoding.UTF8);
  24. string result = doc.ParsedText;
  25. Console.WriteLine(result);
  26. /*
  27. foreach(Match match in Regex.Matches(result, pattern))
  28. {
  29. Console.Write(match.Value);
  30. }*/
  31.  
  32.  
  33.  
  34. Console.ReadLine();
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment