From 5868338b69496139c87d578b6ea70ade14bebb12 Mon Sep 17 00:00:00 2001 From: tonaerospace Date: Tue, 21 Nov 2023 01:56:46 +0000 Subject: [PATCH] update --- src/interface.jl | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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)