Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1.  
  2. --local htmlparser = require("htmlparser")
  3.  
  4. concommand.Add( "testcommand", function( ply, cmd, args )
  5.  
  6.  
  7. local TheReturnedHTML = ""
  8.  
  9. http.Fetch( "http://egamingbets.com/ru/tables#",
  10. function( body, len, headers, code )
  11.  
  12. local sa = body
  13.  
  14. --"sdfsdfsdfsdfsdfsdfsdfsdfsdf <span style='' ng-bind='gamer.full_nick()' class='ng-binding'>ByuN</span> sdfsdfsdfsdfsdfsdfsdfsdfsdf"
  15.  
  16. function parse_me ( s )
  17.  
  18. local string parse = {}; --Массив бла
  19.  
  20.  
  21. local find_one = false;
  22. local str_local = "";
  23. local findS = "<span style='' ng-bind='gamer.full_nick()' class='ng-binding'>";
  24.  
  25.  
  26. local str_r = find_syki(s,findS)
  27. --print(tostring(str_r)..":"..s[str_r])
  28. str_r = str_r + #findS
  29. --print(s[str_r])
  30.  
  31. for i = str_r,#s do
  32. if (s[i]!="<") then str_local = str_local .. s[i] continue; end
  33.  
  34. if (s[i] == "<" ) then
  35. table.insert(parse,str_local);
  36. str_local = "";
  37. break
  38. end
  39.  
  40. end
  41.  
  42. --print("len:"..tostring(#parse))
  43.  
  44. return parse
  45.  
  46. end
  47.  
  48.  
  49. function find_syki (s_1 , s_2)
  50. local ff = false;
  51.  
  52. for i =1,#s_1 do
  53. if (s_1[i] == s_2[1]) then
  54. if check_line(s_1,s_2,i) then
  55. return i
  56. end
  57. end
  58.  
  59.  
  60. end
  61.  
  62. return -1;
  63. end
  64.  
  65. function check_line (s_1,s_2,i)
  66. jj = 1;
  67. --print("I:"..tostring(i).." "..s_1[i])
  68.  
  69. for j=i,#s_1 do
  70. if (s_1[j] == s_2[jj]) then jj=jj+1; if (jj == #s_2) then return true end continue; end
  71. if (s_1[j] != s_2[jj]) then return false end
  72. --print(#s_2) print(tostring(j).." "..tostring(jj)) print(s_1[j] .. " != " .. s_2[jj])
  73. if (jj == #s_2) then return true end
  74. end
  75.  
  76.  
  77. return false
  78. end
  79.  
  80.  
  81. local tbl = parse_me(sa); --здесь типо будет таблица все что он нашел похожее дальше сам отсей
  82.  
  83.  
  84. for k,v in pairs (tbl) do
  85. print(v)
  86. end
  87.  
  88.  
  89.  
  90. end)
  91. end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement