Skip to content

Instantly share code, notes, and snippets.

@shiweifu
Created July 3, 2012 11:46
Show Gist options
  • Save shiweifu/3039265 to your computer and use it in GitHub Desktop.
Save shiweifu/3039265 to your computer and use it in GitHub Desktop.
lua parser youku video
function main()
regex = [[false"><a title="(.-)"%starget=".-"%shref="(.-)%.html"]]
f = io.open("test.html", "r")
html = f:read("*a")
f:close()
s_idx, e_idx, title, url = string.find(html, regex, 0)
while s_idx ~= nil do
print(title)
print(url)
print()
s_idx, e_idx, title, url = string.find(html, regex, e_idx)
end
--print(url)
end
main()
-- s = [[Deadline is 30/05/1999, "firm"]]
-- print(string.find(s,[[(.*)"(.*)"]]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment