Closed aqqdgyz closed 5 years ago
Could you show me your code that can reproduce the problem? I think this problem happens when you somehow ignore other errors or due to an internal bug of EzXML.jl.
push!(LOAD_PATH, ".")
import QCURL
using EzXML
function nodecontent(node::EzXML.Node)
str_ptr = ccall(
(:xmlNodeGetContent, EzXML.libxml2),
Cstring,
(Ptr{Cvoid},),
node.ptr)
str = unsafe_string(str_ptr)
Libc.free(str_ptr)
return str
end
function baidu(kw::String)
reqs = Array{QCURL.RequestDesc}(undef, 0)
for i in 1:1
req = QCURL.RequestDesc()
req.url = "https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=2&tn=baiduhome_pg&wd=$kw&rsv_spt=1&rsv_sug1=1&rsv_sug4=1395&rn=50&pn=$(50 * (i -1))"
req.method="GET"
push!(reqs, req)
end
QCURL.request_from_list(reqs)
for req in reqs
doc = parsehtml(req.response.text)
hrefs = findall("/html/body/div[@id='wrapper']/div[@id='wrapper_wrapper']/div[@id='container']/div[@id='content_left']/div[@class='result c-container ']/h3/a",doc)
titles = findall("/html/body/div[@id='wrapper']/div[@id='wrapper_wrapper']/div[@id='container']/div[@id='content_left']/div[@class='result c-container ']/h3/a/em",doc)
for item in hrefs
println(nodecontent(item))
end
end
end
baidu("测试")
Please quote code with triple backquotes or you'll ping someone else with macros and other @ characters. https://guides.github.com/features/mastering-markdown/
I guess the problem occurred in the @check macro
Do you see any other errors or warnings except this?
This is the complete error message:
ERROR: LoadError: AssertionError: isempty(XML_GLOBAL_ERROR_STACK)
Stacktrace:
[1] macro expansion at C:\Users\X\.juliapro\JuliaPro_v1.0.3.1\packages\EzXML\r19gO\src\error.jl:49 [inlined]
[2] nodecontent(::EzXML.Node) at C:\Users\X\.juliapro\JuliaPro_v1.0.3.1\packages\EzXML\r19gO\src\node.jl:1120
[3] baidu(::String) at D:\Projects\Julia\OSINT.jl:34
[4] top-level scope at none:0
[5] include at .\boot.jl:317 [inlined]
[6] include_relative(::Module, ::String) at .\loading.jl:1044
[7] include(::Module, ::String) at .\sysimg.jl:29
[8] exec_options(::Base.JLOptions) at .\client.jl:266
[9] _start() at .\client.jl:425
in expression starting at D:\Projects\Julia\OSINT.jl:39
Yeah, I know. I think you may perhaps see other errors or warnings before this message, because EzXML.jl is supposed to capture all errors that happen internally. The error you reported will happen when there are errors in the global error stack that are somehow not handled properly.
Okay, I'll check my code. Thank you.
Hi, I tried to access the content of node using "nodecontent", an error message is "ERROR: LoadError: AssertionError: isempty(XML_GLOBAL_ERROR_STACK)"
so, i modify "nodecontent" as this:
And then my code looks right