节点精灵系列 - Lua 纯源码取网络时间

--Time: 202091802:15:42
-- by : MemoryChobits 
-- QQ : 1762272313
function GetMind(str,ks,over)
	local strchar=string.find(str,ks)
	if (strchar>1) then
		local bafter=string.find(str,over,strchar+string.len(ks))
		if (bafter>1) then
			local Getdata=string.sub(str,strchar+string.len(ks),bafter-1)
			print(Getdata);
			return GetData
		end
	end
	return ""
end

function GetTime()
	-- 获取网页的所有数据
	local p={
    
    
		url="http://www.time163.com/";
	}
	res=httpGet(p);
	if res then		
        local time = GetMind(res.body,"<header>\n<time>","</time>")
        return time ;
	else
		print("获取失败")
        return nil ;
	end
end

GetTime()

猜你喜欢

转载自blog.csdn.net/Memroy/article/details/108656869
LUA