diff --git a/src/interface.jl b/src/interface.jl index c0ddf84..f82c544 100755 --- a/src/interface.jl +++ b/src/interface.jl @@ -1038,7 +1038,20 @@ function chunktext(text::T, headers) where {T<:AbstractString} return result end +""" + Search wikipedia. + Args: + query (string): The query to search for + + Returns: + string: The search result text from wikipedia + ```jldoctest + julia> using HTTP, JSON3 + julia> result = wikisearch("AMD") + "Advanced Micro Devices, Inc., commonly abbreviated as AMD, is an ..." + ``` +""" function wikisearch(phrase::T) where {T<:AbstractString} url = "https://en.wikipedia.org/w/api.php?action=query&format=json&prop=extracts&titles=$(replace(phrase, " " => "%20"))&exintro=1&explaintext=1" response = HTTP.get(url)