Advertisement
shqptr

C# xpath

Feb 14th, 2020
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 14.30 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.Net;
  11.  
  12. namespace İddaaTahmin
  13. {
  14.     public partial class Form1 : Form
  15.     {
  16.  
  17.         public String html;
  18.         public Uri url;
  19.         public String address;
  20.         public Form1()
  21.         {
  22.  
  23.             InitializeComponent();
  24.         }
  25.  
  26.         private void eB_Button1_Click(object sender, EventArgs e)
  27.         {
  28.             label1.Text = "Maçlar Çekiliyor ... ";
  29.            
  30.                 //52
  31.             progressBar1.Value = 0;
  32.             for (int i = 3; i < 52; i++)
  33.             {
  34.  
  35.                 progressBar1.Value += 2;
  36.  
  37.              
  38.                
  39.                
  40.  
  41.                VeriAl("https://www.nesine.com/iddaa/populer-bahisler ", "//*[@id='divFootballPartial']/div[1]/div[" + i + "]/div[3]", listBox1);
  42.  
  43.                 VeriAl("https://www.nesine.com/iddaa/populer-bahisler ", "//*[@id='divFootballPartial']/div[1]/div[" + i + "]/div[5]/div[2]", listBox2);
  44.  
  45.                 VeriAl("https://www.nesine.com/iddaa/populer-bahisler ", "//*[@id='divFootballPartial']/div[1]/div[" + i + "]/div[6]/span", listBox3);
  46.  
  47.                 VeriAl("https://www.nesine.com/iddaa/populer-bahisler ", "//*[@id='divFootballPartial']/div[1]/div[" + i + "]/div[2]/span[2]", listBox4);
  48.  
  49.  
  50.  
  51.  
  52.             }
  53.             progressBar1.Value = 100;
  54.            
  55.             label1.Text = "Maçlar Çekildi !";
  56.            
  57.         }
  58.      
  59.         public void VeriAl(String Url, String XPath, ListBox CikanSonuc)
  60.         {
  61.             try
  62.             {
  63.                 url = new Uri(Url);
  64.             }
  65.             catch (UriFormatException)
  66.             {
  67.  
  68.  
  69.             }
  70.             catch (ArgumentNullException)
  71.             {
  72.  
  73.             }
  74.            
  75.             WebClient client = new WebClient();
  76.             client.Encoding = Encoding.UTF8;
  77.             html = client.DownloadString(url);
  78.             html = html.Replace("&# 231;", "ç");
  79.             html = html.Replace("&# 252;", "ü");
  80.             html = html.Replace("&# 246;", "ö");
  81.             try
  82.             {
  83.                
  84.              
  85.             }
  86.             catch (WebException)
  87.             {
  88.  
  89.             }
  90.             HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
  91.             doc.LoadHtml(html);
  92.             try
  93.             {
  94.                
  95.                 CikanSonuc.Items.Add(doc.DocumentNode.SelectSingleNode(XPath).InnerText);
  96.                
  97.                
  98.             }
  99.             catch (NullReferenceException)
  100.             {
  101.  
  102.             }
  103.         }
  104.  
  105.  
  106.  
  107.         private void eB_Theme1_Enter(object sender, EventArgs e)
  108.         {
  109.  
  110.         }
  111.  
  112.  
  113.  
  114.        
  115.        
  116.        
  117.         private void eB_Button2_Click(object sender, EventArgs e)
  118.         {
  119.             //197 tane var
  120.  
  121.                 Form2 frm = new Form2();
  122.  
  123.                
  124.                
  125.                 frm.label1.Text = Convert.ToString(listBox1.Items[2 - 2]);// KARŞILAŞMA
  126.                frm.label2.Text = Convert.ToString(listBox1.Items[3 - 2]);
  127.                frm.label3.Text = Convert.ToString(listBox1.Items[4 - 2]);
  128.                frm.label4.Text = Convert.ToString(listBox1.Items[5 - 2]);
  129.                frm.label5.Text = Convert.ToString(listBox1.Items[6 - 2]);
  130.                frm.label6.Text = Convert.ToString(listBox1.Items[7 - 2]);
  131.                frm.label7.Text = Convert.ToString(listBox1.Items[8 - 2]);
  132.                frm.label8.Text = Convert.ToString(listBox1.Items[9 - 2]);
  133.                frm.label9.Text = Convert.ToString(listBox1.Items[10 - 2]);
  134.                frm.label10.Text = Convert.ToString(listBox1.Items[11 - 2]);
  135.                frm.label11.Text = Convert.ToString(listBox1.Items[12 - 2]);
  136.                frm.label12.Text = Convert.ToString(listBox1.Items[13 - 2]);
  137.                frm.label13.Text = Convert.ToString(listBox1.Items[14 - 2]);
  138.                frm.label14.Text = Convert.ToString(listBox1.Items[15 - 2]);
  139.                frm.label15.Text = Convert.ToString(listBox1.Items[16 - 2]);
  140.                frm.label16.Text = Convert.ToString(listBox1.Items[17 - 2]);
  141.                frm.label17.Text = Convert.ToString(listBox1.Items[18 - 2]);
  142.                frm.label18.Text = Convert.ToString(listBox1.Items[19 - 2]);
  143.                frm.label19.Text = Convert.ToString(listBox1.Items[20 - 2]);
  144.                frm.label20.Text = Convert.ToString(listBox1.Items[21 - 2]);
  145.                frm.label21.Text = Convert.ToString(listBox1.Items[22 - 2]);
  146.                frm.label22.Text = Convert.ToString(listBox1.Items[23 - 2]);
  147.                frm.label23.Text = Convert.ToString(listBox1.Items[24 - 2]);
  148.                frm.label24.Text = Convert.ToString(listBox1.Items[25 - 2]);
  149.                frm.label25.Text = Convert.ToString(listBox1.Items[26 - 2]);
  150.                frm.label26.Text = Convert.ToString(listBox1.Items[27 - 2]);
  151.                frm.label27.Text = Convert.ToString(listBox1.Items[28 - 2]);
  152.                frm.label28.Text = Convert.ToString(listBox1.Items[29 - 2]);
  153.                frm.label29.Text = Convert.ToString(listBox1.Items[30 - 2]);
  154.                frm.label30.Text = Convert.ToString(listBox1.Items[31 - 2]);
  155.                frm.label31.Text = Convert.ToString(listBox1.Items[32 - 2]);
  156.                frm.label32.Text = Convert.ToString(listBox1.Items[33 - 2]);
  157.                frm.label33.Text = Convert.ToString(listBox1.Items[34 - 2]);
  158.                frm.label34.Text = Convert.ToString(listBox1.Items[35 - 2]);
  159.                frm.label35.Text = Convert.ToString(listBox1.Items[36 - 2]);
  160.                frm.label36.Text = Convert.ToString(listBox1.Items[37 - 2]);//KARŞILAŞMA SON
  161.  
  162.                frm.label37.Text = Convert.ToString(listBox2.Items[2 - 2]);// MS - KG
  163.                frm.label38.Text = Convert.ToString(listBox2.Items[3 - 2]);
  164.                frm.label39.Text = Convert.ToString(listBox2.Items[4 - 2]);
  165.                frm.label40.Text = Convert.ToString(listBox2.Items[5 - 2]);
  166.                frm.label41.Text = Convert.ToString(listBox2.Items[6 - 2]);
  167.                frm.label42.Text = Convert.ToString(listBox2.Items[7 - 2]);
  168.                frm.label43.Text = Convert.ToString(listBox2.Items[8 - 2]);
  169.               frm.label44.Text = Convert.ToString(listBox2.Items[9 - 2]);
  170.                frm.label45.Text = Convert.ToString(listBox2.Items[10 - 2]);
  171.                frm.label46.Text = Convert.ToString(listBox2.Items[11 - 2]);
  172.                frm.label47.Text = Convert.ToString(listBox2.Items[12 - 2]);
  173.                frm.label48.Text = Convert.ToString(listBox2.Items[13 - 2]);
  174.                frm.label49.Text = Convert.ToString(listBox2.Items[14 - 2]);
  175.                frm.label50.Text = Convert.ToString(listBox2.Items[15 - 2]);
  176.                frm.label51.Text = Convert.ToString(listBox2.Items[16 - 2]);
  177.                frm.label52.Text = Convert.ToString(listBox2.Items[17 - 2]);
  178.                frm.label53.Text = Convert.ToString(listBox2.Items[18 - 2]);
  179.                frm.label54.Text = Convert.ToString(listBox2.Items[19 - 2]);
  180.                frm.label55.Text = Convert.ToString(listBox2.Items[20 - 2]);
  181.                frm.label56.Text = Convert.ToString(listBox2.Items[21 - 2]);
  182.                frm.label57.Text = Convert.ToString(listBox2.Items[22 - 2]);
  183.                frm.label58.Text = Convert.ToString(listBox2.Items[23 - 2]);
  184.                frm.label59.Text = Convert.ToString(listBox2.Items[24 - 2]);
  185.                frm.label60.Text = Convert.ToString(listBox2.Items[25 - 2]);
  186.                frm.label61.Text = Convert.ToString(listBox2.Items[26 - 2]);
  187.                frm.label62.Text = Convert.ToString(listBox2.Items[27 - 2]);
  188.                frm.label63.Text = Convert.ToString(listBox2.Items[28 - 2]);
  189.                frm.label64.Text = Convert.ToString(listBox2.Items[29 - 2]);
  190.                frm.label65.Text = Convert.ToString(listBox2.Items[30 - 2]);
  191.                frm.label66.Text = Convert.ToString(listBox2.Items[31 - 2]);
  192.                frm.label67.Text = Convert.ToString(listBox2.Items[32 - 2]);
  193.                frm.label68.Text = Convert.ToString(listBox2.Items[33 - 2]);
  194.                frm.label69.Text = Convert.ToString(listBox2.Items[34 - 2]);
  195.                frm.label70.Text = Convert.ToString(listBox2.Items[35 - 2]);
  196.                frm.label71.Text = Convert.ToString(listBox2.Items[36 - 2]);
  197.                frm.label72.Text = Convert.ToString(listBox2.Items[37 - 2]);// MS-KG SON
  198.  
  199.                frm.label73.Text = Convert.ToString(listBox3.Items[2 - 2]);// ORAN
  200.                frm.label74.Text = Convert.ToString(listBox3.Items[3 - 2]);
  201.                frm.label75.Text = Convert.ToString(listBox3.Items[4 - 2]);
  202.                frm.label76.Text = Convert.ToString(listBox3.Items[5 - 2]);
  203.                frm.label77.Text = Convert.ToString(listBox3.Items[6 - 2]);
  204.                frm.label78.Text = Convert.ToString(listBox3.Items[7 - 2]);
  205.                frm.label79.Text = Convert.ToString(listBox3.Items[8 - 2]);
  206.                frm.label80.Text = Convert.ToString(listBox3.Items[9 - 2]);
  207.                frm.label81.Text = Convert.ToString(listBox3.Items[10 - 2]);
  208.                frm.label82.Text = Convert.ToString(listBox3.Items[11 - 2]);
  209.                frm.label83.Text = Convert.ToString(listBox3.Items[12 - 2]);
  210.                frm.label84.Text = Convert.ToString(listBox3.Items[13 - 2]);
  211.                frm.label85.Text = Convert.ToString(listBox3.Items[14 - 2]);
  212.                frm.label86.Text = Convert.ToString(listBox3.Items[15 - 2]);
  213.                frm.label87.Text = Convert.ToString(listBox3.Items[16 - 2]);
  214.                frm.label88.Text = Convert.ToString(listBox3.Items[17 - 2]);
  215.                frm.label89.Text = Convert.ToString(listBox3.Items[18 - 2]);
  216.                frm.label90.Text = Convert.ToString(listBox3.Items[19 - 2]);
  217.                frm.label91.Text = Convert.ToString(listBox3.Items[20 - 2]);
  218.                frm.label92.Text = Convert.ToString(listBox3.Items[21 - 2]);
  219.                frm.label93.Text = Convert.ToString(listBox3.Items[22 - 2]);
  220.                frm.label94.Text = Convert.ToString(listBox3.Items[23 - 2]);
  221.                frm.label95.Text = Convert.ToString(listBox3.Items[24 - 2]);
  222.                frm.label96.Text = Convert.ToString(listBox3.Items[25 - 2]);
  223.                frm.label97.Text = Convert.ToString(listBox3.Items[26 - 2]);
  224.                frm.label98.Text = Convert.ToString(listBox3.Items[27 - 2]);
  225.                frm.label99.Text = Convert.ToString(listBox3.Items[28 - 2]);
  226.                frm.label100.Text = Convert.ToString(listBox3.Items[29 - 2]);
  227.                frm.label101.Text = Convert.ToString(listBox3.Items[30 - 2]);
  228.                frm.label102.Text = Convert.ToString(listBox3.Items[31 - 2]);
  229.                frm.label103.Text = Convert.ToString(listBox3.Items[32 - 2]);
  230.                frm.label104.Text = Convert.ToString(listBox3.Items[33 - 2]);
  231.                frm.label105.Text = Convert.ToString(listBox3.Items[34 - 2]);
  232.                frm.label106.Text = Convert.ToString(listBox3.Items[35 - 2]);
  233.                frm.label107.Text = Convert.ToString(listBox3.Items[36 - 2]);
  234.                frm.label108.Text = Convert.ToString(listBox3.Items[37 - 2]);// ORAN SON
  235.  
  236.                frm.label109.Text = Convert.ToString(listBox4.Items[2 - 2]);// SAAT
  237.                frm.label110.Text = Convert.ToString(listBox4.Items[3 - 2]);
  238.                frm.label111.Text = Convert.ToString(listBox4.Items[4 - 2]);
  239.                frm.label112.Text = Convert.ToString(listBox4.Items[5 - 2]);
  240.                frm.label113.Text = Convert.ToString(listBox4.Items[6 - 2]);
  241.                frm.label114.Text = Convert.ToString(listBox4.Items[7 - 2]);
  242.                frm.label115.Text = Convert.ToString(listBox4.Items[8 - 2]);
  243.                frm.label116.Text = Convert.ToString(listBox4.Items[9 - 2]);
  244.                frm.label117.Text = Convert.ToString(listBox4.Items[10 - 2]);
  245.                frm.label118.Text = Convert.ToString(listBox4.Items[11 - 2]);
  246.                frm.label119.Text = Convert.ToString(listBox4.Items[12 - 2]);
  247.                frm.label120.Text = Convert.ToString(listBox4.Items[13 - 2]);
  248.                frm.label121.Text = Convert.ToString(listBox4.Items[14 - 2]);
  249.                frm.label122.Text = Convert.ToString(listBox4.Items[15 - 2]);
  250.                frm.label123.Text = Convert.ToString(listBox4.Items[16 - 2]);
  251.                frm.label124.Text = Convert.ToString(listBox4.Items[17 - 2]);
  252.                frm.label125.Text = Convert.ToString(listBox4.Items[18 - 2]);
  253.                frm.label126.Text = Convert.ToString(listBox4.Items[19 - 2]);
  254.                frm.label127.Text = Convert.ToString(listBox4.Items[20 - 2]);
  255.                frm.label128.Text = Convert.ToString(listBox4.Items[21 - 2]);
  256.                frm.label129.Text = Convert.ToString(listBox4.Items[22 - 2]);
  257.                frm.label130.Text = Convert.ToString(listBox4.Items[23 - 2]);
  258.                frm.label131.Text = Convert.ToString(listBox4.Items[24 - 2]);
  259.                frm.label132.Text = Convert.ToString(listBox4.Items[25 - 2]);
  260.                frm.label133.Text = Convert.ToString(listBox4.Items[26 - 2]);
  261.                frm.label134.Text = Convert.ToString(listBox4.Items[27 - 2]);
  262.                frm.label135.Text = Convert.ToString(listBox4.Items[28 - 2]);
  263.                frm.label136.Text = Convert.ToString(listBox4.Items[29 - 2]);
  264.                frm.label137.Text = Convert.ToString(listBox4.Items[30 - 2]);
  265.                frm.label138.Text = Convert.ToString(listBox4.Items[31 - 2]);
  266.                frm.label139.Text = Convert.ToString(listBox4.Items[32 - 2]);
  267.                frm.label140.Text = Convert.ToString(listBox4.Items[33 - 2]);
  268.                frm.label141.Text = Convert.ToString(listBox4.Items[34 - 2]);
  269.                frm.label142.Text = Convert.ToString(listBox4.Items[35 - 2]);
  270.                frm.label143.Text = Convert.ToString(listBox1.Items[36 - 2]);
  271.                frm.label144.Text = Convert.ToString(listBox4.Items[37 - 2]);// SAAT SON
  272.                
  273.                 frm.Show();
  274.  
  275.  
  276.            
  277.            
  278.            
  279.         }
  280.  
  281.        
  282.  
  283.         private void Form1_Load(object sender, EventArgs e)
  284.         {
  285.  
  286.         }
  287.  
  288.         private void listBox1_SelectedIndexChanged_1(object sender, EventArgs e)
  289.         {
  290.            
  291.         }
  292.  
  293.  
  294.      
  295.     }
  296. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement