Yahoo! search interface: Difference between revisions
Content added Content deleted
Line 1,461: | Line 1,461: | ||
} |
} |
||
}</lang> |
}</lang> |
||
=={{header|Julia}}== |
|||
<lang julia>""" Rosetta Code Yahoo search task. https://rosettacode.org/wiki/Yahoo!_search_interface """ |
|||
using EzXML |
|||
using HTTP |
|||
using Logging |
|||
const pagesize = 7 |
|||
const URI = "https://search.yahoo.com/search?fr=opensearch&pz=$pagesize&" |
|||
struct SearchResults |
|||
title::String |
|||
content::String |
|||
url::String |
|||
end |
|||
mutable struct YahooSearch |
|||
search::String |
|||
yahoourl::String |
|||
pagesize::Int |
|||
currentpage::Int |
|||
usedpages::Vector{Int} |
|||
results::Vector{SearchResults} |
|||
end |
|||
YahooSearch(s, url = URI, pz = pagesize) = |
|||
YahooSearch(s, url, pz, 1, Int[], SearchResults[]) |
|||
function NextPage(yah::YahooSearch, link, pagenum) |
|||
oldpage = yah.currentpage |
|||
yah.currentpage = pagenum |
|||
search(yah) |
|||
yah.currentpage = oldpage |
|||
end |
|||
function search(yah::YahooSearch) |
|||
push!(yah.usedpages, yah.currentpage) |
|||
queryurl = yah.yahoourl * "b=$(yah.currentpage)&p=" * HTTP.escapeuri(yah.search) |
|||
req = HTTP.request("GET", queryurl) |
|||
# Yahoo's HTML is nonstandard, so send excess warnings from the parser to NullLogger |
|||
html = with_logger(NullLogger()) do |
|||
parsehtml(String(req.body)) |
|||
end |
|||
for div in findall("//li/div", html) |
|||
if haskey(div, "class") |
|||
if startswith(div["class"], "dd algo") && |
|||
(a = findfirst("div/h3/a", div)) != nothing && |
|||
haskey(a, "href") |
|||
url, title, content = a["href"], nodecontent(a), "None" |
|||
for span in findall("div/p/span", div) |
|||
if haskey(span, "class") && occursin("fc-falcon", span["class"]) |
|||
content = nodecontent(span) |
|||
end |
|||
end |
|||
push!(yah.results, SearchResults(title, content, url)) |
|||
elseif startswith(div["class"], "dd pagination") |
|||
for a in findall("div/div/a", div) |
|||
if haskey(a, "href") |
|||
lnk, n = a["href"], tryparse(Int, nodecontent(a)) |
|||
!isnothing(n) && !(n in yah.usedpages) && NextPage(yah, lnk, n) |
|||
end |
|||
end |
|||
end |
|||
end |
|||
end |
|||
end |
|||
ysearch = YahooSearch("RosettaCode") |
|||
search(ysearch) |
|||
println("Searching Yahoo for `RosettaCode`:") |
|||
println( |
|||
"Found ", |
|||
length(ysearch.results), |
|||
" entries on ", |
|||
length(ysearch.usedpages), |
|||
" pages.\n", |
|||
) |
|||
for res in ysearch.results |
|||
println("Title: ", res.title) |
|||
println("Content: ", res.content) |
|||
println("URL: ", res.url, "\n") |
|||
end |
|||
</lang>{{out}} |
|||
<pre> |
|||
Searching Yahoo for `RosettaCode`: |
|||
Found 34 entries on 5 pages. |
|||
Title: rosettacode.orgRosetta Code |
|||
Content: Rosetta Code is a programming chrestomathy site. The idea is to present solutions to the same task in as |
|||
many different languages as possible, to demonstrate how languages are similar and different, and to aid a person |
|||
with a grounding in one approach to a problem in learning another. |
|||
URL: https://rosettacode.org/wiki/Rosetta_Code |
|||
Title: en.wikipedia.org › wiki › Rosetta_CodeRosetta Code - Wikipedia |
|||
Content: Rosetta Code is a wiki-based programming website with implementations of common algorithms and solutions |
|||
to various programming problems in many different programming languages. It is named for the Rosetta Stone , which has the same text inscribed on it in three languages, and thus allowed Egyptian hieroglyphs to be deciphered for |
|||
the first time. |
|||
URL: https://en.wikipedia.org/wiki/Rosetta_Code |
|||
Title: raku.org › community › rosettacodeRaku on Rosetta Code |
|||
Content: Raku on Rosetta Code. Rosetta Code is a community site that presents solutions to programming tasks in many different languages. It is an excellent place to see how various languages approach the same task, as well as to get a feel for the style and fluent use of each language across a variety of domains. |
|||
URL: https://raku.org/community/rosettacode/ |
|||
Title: github.com › gerph › rosettacodeGitHub - gerph/rosettacode: Library for accessing Rosetta Code |
|||
Content: None |
|||
URL: https://github.com/gerph/rosettacode |
|||
Title: simple.wikipedia.org › wiki › Rosetta_CodeRosetta Code - Simple English Wikipedia, the free encyclopedia |
|||
Content: Website. Rosetta Code was created in 2007 by Michael Mol. The site's content is licensed under the GNU Free Documentation License 1.2, though some components may have two licenses under less strict terms. |
|||
URL: https://simple.wikipedia.org/wiki/Rosetta_Code |
|||
Title: blog.rosettacode.org › 2011Rosetta Code Blog: 2011 |
|||
Content: (If you point 'rosettacode.com' to RosettaCode.org's IP address, you should still be able to see it) Second, I don't care if you want to use the name 'rosettacode' or 'rosetta code' in similar pursuits. I love that people have been calling task pages that have cropped up on various forums around the web as "rosetta code problems." |
|||
That speaks ... |
|||
URL: https://blog.rosettacode.org/2011/ |
|||
Title: rosettacode.org › wiki › Category:Programming_LanguagesCategory:Programming Languages - Rosetta Code |
|||
Content: A programming language is a symbolic representation of a specification for computer behavior. A side-by-side comparison of many of the languages on Rosetta Code can be seen here . These are the programming languages that are mentioned throughout Rosetta Code. If you know a language not listed here then suggest or add it. |
|||
URL: https://rosettacode.org/wiki/Category:Programming_Languages |
|||
Title: en.wikipedia.org › wiki › Rosetta_CodeRosetta Code - Wikipedia |
|||
Content: Rosetta Code is a wiki-based programming website with implementations of common algorithms and solutions |
|||
to various programming problems in many different programming languages. It is named for the Rosetta Stone , which has the same text inscribed on it in three languages, and thus allowed Egyptian hieroglyphs to be deciphered for |
|||
the first time. |
|||
URL: https://en.wikipedia.org/wiki/Rosetta_Code |
|||
Title: github.com › gerph › rosettacodeGitHub - gerph/rosettacode: Library for accessing Rosetta Code |
|||
Content: Rosetta Code reading Introduction. The rosettacode.org site provides example code for a variety for different tasks in many different languages. Because the code is generally pretty self contained and simple - as the point is to show the differences in the way languages do things - it makes a good source of code to try things out with. |
|||
URL: https://github.com/gerph/rosettacode |
|||
Title: raku.org › community › rosettacodeRaku on Rosetta Code |
|||
Content: Raku on Rosetta Code. Rosetta Code is a community site that presents solutions to programming tasks in many different languages. It is an excellent place to see how various languages approach the same task, as well as to get a feel for the style and fluent use of each language across a variety of domains. |
|||
URL: https://raku.org/community/rosettacode/ |
|||
Title: www.retailmenot.com › view › rosettastone10% Off Rosetta Stone Coupons, Promo Codes + 1% Cash Back 2021 |
|||
Content: Rosetta Stone offers computer assisted language learning programs for 31 different languages. It has kiosk outlets located in almost all major airports of the world and it offers trials and demos in addition to its 6 month money back guarantee. |
|||
URL: https://www.retailmenot.com/view/rosettastone.com |
|||
Title: simple.wikipedia.org › wiki › Rosetta_CodeRosetta Code - Simple English Wikipedia, the free encyclopedia |
|||
Content: Website. Rosetta Code was created in 2007 by Michael Mol. The site's content is licensed under the GNU Free Documentation License 1.2, though some components may have two licenses under less strict terms. |
|||
URL: https://simple.wikipedia.org/wiki/Rosetta_Code |
|||
Title: twitter.com › rosettacodeRosetta Code (@RosettaCode) | Twitter |
|||
Content: We would like to show you a description here but the site won’t allow us. |
|||
URL: https://twitter.com/rosettacode |
|||
Title: rosettacode.org › wiki › Category:Programming_TasksCategory:Programming Tasks - Rosetta Code |
|||
Content: Category:Programming Tasks. Programming tasks are problems that may be solved through programming. When such a task is defined, Rosetta Code users are encouraged to solve them using as many different languages as they know. The end goal is to demonstrate how the same task is accomplished in different languages. |
|||
URL: https://rosettacode.org/wiki/Category:Programming_Tasks |
|||
Title: en.wikipedia.org › wiki › Rosetta_CodeRosetta Code - Wikipedia |
|||
Content: Rosetta Code is a wiki-based programming website with implementations of common algorithms and solutions |
|||
to various programming problems in many different programming languages. It is named for the Rosetta Stone , which has the same text inscribed on it in three languages, and thus allowed Egyptian hieroglyphs to be deciphered for |
|||
the first time. |
|||
URL: https://en.wikipedia.org/wiki/Rosetta_Code |
|||
Title: improbotics.org › rosetta-codeRosetta Code – Improbotics |
|||
Content: Rosetta Code was scheduled to perform at Brighton Fringe 2020 at The Warren: Theatre Box and at Camden Fringe 2020 at The Cockpit Theatre and will return live in 2021. Our show was the subject of a scientific research paper “Rosetta Code: Improv in Any Language“, published at the International Conference on Computational Creativity 2020. |
|||
URL: https://improbotics.org/rosetta-code/ |
|||
Title: raku.org › community › rosettacodeRaku on Rosetta Code |
|||
Content: Raku on Rosetta Code. Rosetta Code is a community site that presents solutions to programming tasks in many different languages. It is an excellent place to see how various languages approach the same task, as well as to get a feel for the style and fluent use of each language across a variety of domains. |
|||
URL: https://raku.org/community/rosettacode/ |
|||
Title: www.retailmenot.com › view › rosettastone10% Off Rosetta Stone Coupons, Promo Codes + 1% Cash Back 2021 |
|||
Content: Rosetta Stone offers computer assisted language learning programs for 31 different languages. It has kiosk outlets located in almost all major airports of the world and it offers trials and demos in addition to its 6 month money back guarantee. |
|||
URL: https://www.retailmenot.com/view/rosettastone.com |
|||
Title: github.com › gerph › rosettacodeGitHub - gerph/rosettacode: Library for accessing Rosetta Code |
|||
Content: Rosetta Code reading Introduction. The rosettacode.org site provides example code for a variety for different tasks in many different languages. Because the code is generally pretty self contained and simple - as the point is to show the differences in the way languages do things - it makes a good source of code to try things out with. |
|||
URL: https://github.com/gerph/rosettacode |
|||
Title: twitter.com › rosettacodeRosetta Code (@RosettaCode) | Twitter |
|||
Content: We would like to show you a description here but the site won’t allow us. |
|||
URL: https://twitter.com/rosettacode |
|||
Title: en.wikipedia.org › wiki › Rosetta_CodeRosetta Code - Wikipedia |
|||
Content: Rosetta Code is a wiki-based programming website with implementations of common algorithms and solutions |
|||
to various programming problems in many different programming languages. It is named for the Rosetta Stone , which has the same text inscribed on it in three languages, and thus allowed Egyptian hieroglyphs to be deciphered for |
|||
the first time. |
|||
URL: https://en.wikipedia.org/wiki/Rosetta_Code |
|||
Title: en.wikipedia.org › wiki › RosettacodeRosetta Code - Wikipedia |
|||
Content: Rosetta Code is a wiki-based programming website with implementations of common algorithms and solutions |
|||
to various programming problems in many different programming languages. It is named for the Rosetta Stone , which has the same text inscribed on it in three languages, and thus allowed Egyptian hieroglyphs to be deciphered for |
|||
the first time. |
|||
URL: https://en.wikipedia.org/wiki/Rosettacode |
|||
Title: improbotics.org › rosetta-codeRosetta Code – Improbotics |
|||
Content: Rosetta Code was scheduled to perform at Brighton Fringe 2020 at The Warren: Theatre Box and at Camden Fringe 2020 at The Cockpit Theatre and will return live in 2021. Our show was the subject of a scientific research paper “Rosetta Code: Improv in Any Language“, published at the International Conference on Computational Creativity 2020. |
|||
URL: https://improbotics.org/rosetta-code/ |
|||
Title: rosettacode.org › wiki › OpenGLOpenGL/Phix - Rosetta Code |
|||
Content: OpenGL/Phix. From Rosetta Code. < OpenGL. Jump to: navigation. , search. Older win32-only and OpenGL 1.0 |
|||
(ie not p2js compatible) versions of the OpenGL task. Adapted from the included demo\Arwen32dibdemo\shadepol.exw, |
|||
draws the same thing as the image at the top of this page, but (as per the talk page) does not use openGL, just windows api ... |
|||
URL: https://rosettacode.org/wiki/OpenGL/Phix |
|||
Title: rosettacode.org › wiki › Matrix_multiplicationMatrix multiplication - Rosetta Code |
|||
Content: 360 Assembly [] * Matrix multiplication 06/08/2015 MATRIXRC CSECT Matrix multiplication USING MATRIXRC,R13 SAVEARA B STM-SAVEARA(R15) |
|||
URL: https://rosettacode.org/wiki/Matrix_multiplication |
|||
Title: github.com › gerph › rosettacodeGitHub - gerph/rosettacode: Library for accessing Rosetta Code |
|||
Content: Rosetta Code reading Introduction. The rosettacode.org site provides example code for a variety for different tasks in many different languages. Because the code is generally pretty self contained and simple - as the point is to show the differences in the way languages do things - it makes a good source of code to try things out with. |
|||
URL: https://github.com/gerph/rosettacode |
|||
Title: raku.org › community › rosettacodeRaku on Rosetta Code |
|||
Content: Raku on Rosetta Code. Rosetta Code is a community site that presents solutions to programming tasks in many different languages. It is an excellent place to see how various languages approach the same task, as well as to get a feel for the style and fluent use of each language across a variety of domains. |
|||
URL: https://raku.org/community/rosettacode/ |
|||
Title: en.wikipedia.org › wiki › Rosetta_CodeRosetta Code - Wikipedia |
|||
Content: Rosetta Code is a wiki-based programming website with implementations of common algorithms and solutions |
|||
to various programming problems in many different programming languages. It is named for the Rosetta Stone , which has the same text inscribed on it in three languages, and thus allowed Egyptian hieroglyphs to be deciphered for |
|||
the first time. |
|||
URL: https://en.wikipedia.org/wiki/Rosetta_Code |
|||
Title: en.wikipedia.org › wiki › RosettacodeRosetta Code - Wikipedia |
|||
Content: Rosetta Code is a wiki-based programming website with implementations of common algorithms and solutions |
|||
to various programming problems in many different programming languages. It is named for the Rosetta Stone , which has the same text inscribed on it in three languages, and thus allowed Egyptian hieroglyphs to be deciphered for |
|||
the first time. |
|||
URL: https://en.wikipedia.org/wiki/Rosettacode |
|||
Title: improbotics.org › rosetta-codeRosetta Code – Improbotics |
|||
Content: Rosetta Code was scheduled to perform at Brighton Fringe 2020 at The Warren: Theatre Box and at Camden Fringe 2020 at The Cockpit Theatre and will return live in 2021. Our show was the subject of a scientific research paper “Rosetta Code: Improv in Any Language“, published at the International Conference on Computational Creativity 2020. |
|||
URL: https://improbotics.org/rosetta-code/ |
|||
Title: rosettacode.org › wiki › OpenGLOpenGL/Phix - Rosetta Code |
|||
Content: OpenGL/Phix. From Rosetta Code. < OpenGL. Jump to: navigation. , search. Older win32-only and OpenGL 1.0 |
|||
(ie not p2js compatible) versions of the OpenGL task. Adapted from the included demo\Arwen32dibdemo\shadepol.exw, |
|||
draws the same thing as the image at the top of this page, but (as per the talk page) does not use openGL, just windows api ... |
|||
URL: https://rosettacode.org/wiki/OpenGL/Phix |
|||
Title: raku.org › community › rosettacodeRaku on Rosetta Code |
|||
Content: Raku on Rosetta Code. Rosetta Code is a community site that presents solutions to programming tasks in many different languages. It is an excellent place to see how various languages approach the same task, as well as to get a feel for the style and fluent use of each language across a variety of domains. |
|||
URL: https://raku.org/community/rosettacode/ |
|||
Title: rosettacode.org › wiki › Fast_Fourier_transformFast Fourier transform - Rosetta Code |
|||
Content: Task. Calculate the FFT ( F ast F ourier T ransform) of an input sequence. The most general case allows for complex numbers at the input and results in a sequence of equal length, again of complex numbers. If you need to restrict yourself to real numbers, the output should be the magnitude (i.e.: sqrt (re 2 + im 2 )) of the complex result. |
|||
URL: https://rosettacode.org/wiki/Fast_Fourier_transform |
|||
Title: simple.wikipedia.org › wiki › Rosetta_CodeRosetta Code - Simple English Wikipedia, the free encyclopedia |
|||
Content: Website. Rosetta Code was created in 2007 by Michael Mol. The site's content is licensed under the GNU Free Documentation License 1.2, though some components may have two licenses under less strict terms. |
|||
URL: https://simple.wikipedia.org/wiki/Rosetta_Code |
|||
</pre> |
|||
=={{header|Kotlin}}== |
=={{header|Kotlin}}== |