Yahoo! search interface: Difference between revisions

m
m (→‎{{header|Wren}}: Minor tidy)
 
(20 intermediate revisions by 10 users not shown)
Line 5:
It must implement a '''Next Page''' method, and read URL, Title and Content from results.
<br><br>
=={{header|AArch64 Assembly}}==
{{works with|as|Raspberry Pi 3B version Buster 64 bits}}
<syntaxhighlight lang="aarch64 assembly">
/* ARM assembly AARCH64 Raspberry PI 3B */
/* program yahoosearch64.s */
 
/* access RosettaCode.org and data extract */
/* use openssl for access to port 443 */
/* test openssl : package libssl-dev */
/*******************************************/
/* Constantes file */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"
 
.equ TAILLEBUFFER, 500
 
.equ SSL_OP_NO_SSLv3, 0x02000000
.equ SSL_OP_NO_COMPRESSION, 0x00020000
.equ SSL_MODE_AUTO_RETRY, 0x00000004
.equ SSL_CTRL_MODE, 33
 
.equ BIO_C_SET_CONNECT, 100
.equ BIO_C_DO_STATE_MACHINE, 101
.equ BIO_C_SET_SSL, 109
.equ BIO_C_GET_SSL, 110
 
.equ LGBUFFERREQ, 512001
 
/*********************************/
/* Initialized data */
/*********************************/
.data
szMessDebutPgm: .asciz "Début du programme. \n"
szRetourLigne: .asciz "\n"
szMessFinOK: .asciz "Fin normale du programme. \n"
szMessErreur: .asciz "Erreur !!!"
szMessExtractArea: .asciz "Extraction = "
szNomSite1: .asciz "search.yahoo.com:443" // host name and port
szLibStart: .asciz ">Rosetta Code" // search string
szNomrepCertif: .asciz "/pi/certificats"
szRequete1: .asciz "GET /search?p=\"Rosettacode.org\"&b=1 HTTP/1.1 \r\nHost: search.yahoo.com\r\nConnection: keep-alive\r\nContent-Type: text/plain\r\n\r\n"
/*********************************/
/* UnInitialized data */
/*********************************/
.bss
.align 4
sBufferreq: .skip LGBUFFERREQ
szExtractArea: .skip TAILLEBUFFER
stNewSSL: .skip 200
/*********************************/
/* code section */
/*********************************/
.text
.global main
main:
ldr x0,qAdrszMessDebutPgm
bl affichageMess // start message
 
/* connexion host port 443 and send query */
bl envoiRequete
cmp x0,#-1
beq 99f // error ?
 
bl analyseReponse
 
ldr x0,qAdrszMessFinOK // end message
bl affichageMess
mov x0, #0 // return code ok
b 100f
99:
ldr x0,qAdrszMessErreur // error
bl affichageMess
mov x0, #1 // return code error
b 100f
100:
mov x8,EXIT // program end
svc 0 // system call
qAdrszMessDebutPgm: .quad szMessDebutPgm
qAdrszMessFinOK: .quad szMessFinOK
qAdrszMessErreur: .quad szMessErreur
 
/*********************************************************/
/* connexion host port 443 and send query */
/*********************************************************/
envoiRequete:
stp x1,lr,[sp,-16]! // save registers
stp x2,x3,[sp,-16]! // save registers
stp x4,x5,[sp,-16]! // save registers
//*************************************
// openSsl functions use *
//*************************************
//init ssl
bl OPENSSL_init_crypto
bl ERR_load_BIO_strings
mov x2, #0
mov x1, #0
mov x0, #2
bl OPENSSL_init_crypto
mov x2, #0
mov x1, #0
mov x0, #0
bl OPENSSL_init_ssl
cmp x0,#0
blt erreur
bl TLS_client_method
bl SSL_CTX_new
cmp x0,#0
ble erreur
mov x20,x0 // save contex
ldr x1,iFlag
bl SSL_CTX_set_options
mov x0,x20 // contex
mov x1,#0
ldr x2,qAdrszNomrepCertif
bl SSL_CTX_load_verify_locations
cmp x0,#0
ble erreur
mov x0,x20 // contex
bl BIO_new_ssl_connect
cmp x0,#0
ble erreur
mov x21,x0 // save bio
mov x1,#BIO_C_GET_SSL
mov x2,#0
ldr x3,qAdrstNewSSL
bl BIO_ctrl
ldr x0,qAdrstNewSSL
ldr x0,[x0]
mov x1,#SSL_CTRL_MODE
mov x2,#SSL_MODE_AUTO_RETRY
mov x3,#0
bl SSL_ctrl
mov x0,x21 // bio
mov x1,#BIO_C_SET_CONNECT
mov x2,#0
ldr x3,qAdrszNomSite1
bl BIO_ctrl
mov x0,x21 // bio
mov x1,#BIO_C_DO_STATE_MACHINE
mov x2,#0
mov x3,#0
bl BIO_ctrl
// compute query length
mov x2,#0
ldr x1,qAdrszRequete1 // query
1:
ldrb w0,[x1,x2]
cmp x0,#0
add x8,x2,1
csel x2,x8,x2,ne
bne 1b
// send query
mov x0,x21 // bio
// x1 = address query
// x2 = length query
mov x3,#0
bl BIO_write // send query
cmp x0,#0
blt erreur
ldr x22,qAdrsBufferreq // buffer address
2: // begin loop to read datas
mov x0,x21 // bio
mov x1,x22 // buffer address
ldr x2,qLgBuffer
mov x3,#0
bl BIO_read
cmp x0,#0
ble 4f // error ou pb server
add x22,x22,x0
sub x2,x22,#8
ldr x2,[x2]
ldr x3,qCharEnd
cmp x2,x3 // text end ?
beq 4f
mov x1,#0xFFFFFF // delay loop
3:
subs x1,x1,1
bgt 3b
b 2b // loop read other chunk
4: // read end
//ldr x0,qAdrsBufferreq // to display buffer response of the query
//bl affichageMess
mov x0, x21 // close bio
bl BIO_free_all
mov x0,#0
b 100f
erreur: // error display
ldr x1,qAdrszMessErreur
bl afficheErreur
mov x0,#-1 // error code
b 100f
100:
ldp x4,x5,[sp],16 // restaur 2 registers
ldp x2,x3,[sp],16 // restaur 2 registers
ldp x1,lr,[sp],16 // restaur 2 registers
ret // return to address lr x30
qAdrszRequete1: .quad szRequete1
qAdrsBufferreq: .quad sBufferreq
iFlag: .quad SSL_OP_NO_SSLv3 | SSL_OP_NO_COMPRESSION
qAdrstNewSSL: .quad stNewSSL
qAdrszNomSite1: .quad szNomSite1
qAdrszNomrepCertif: .quad szNomrepCertif
qCharEnd: .quad 0x0A0D0A0D300A0D0A
qLgBuffer: .quad LGBUFFERREQ - 1
/*********************************************************/
/* response analyze */
/*********************************************************/
analyseReponse:
stp x1,lr,[sp,-16]! // save registers
stp x2,x3,[sp,-16]! // save registers
ldr x0,qAdrsBufferreq // buffer address
ldr x1,qAdrszLibStart // key text address
mov x2,#2 // occurence key text
mov x3,#-11 // offset
ldr x4,qAdrszExtractArea // address result area
bl extChaine
cmp x0,#-1
beq 99f
ldr x0,qAdrszMessExtractArea
bl affichageMess
ldr x0,qAdrszExtractArea // résult display
bl affichageMess
ldr x0,qAdrszRetourLigne
bl affichageMess
b 100f
99:
ldr x0,qAdrszMessErreur // error
bl affichageMess
mov x0, #-1 // error return code
b 100f
100:
ldp x2,x3,[sp],16 // restaur 2 registers
ldp x1,lr,[sp],16 // restaur 2 registers
ret // return to address lr x30
qAdrszLibStart: .quad szLibStart
qAdrszExtractArea: .quad szExtractArea
qAdrszMessExtractArea: .quad szMessExtractArea
qAdrszRetourLigne: .quad szRetourLigne
/*********************************************************/
/* Text Extraction behind text key */
/*********************************************************/
/* x0 buffer address */
/* x1 key text to search */
/* x2 number occurences to key text */
/* x3 offset */
/* x4 result address */
extChaine:
stp x1,lr,[sp,-16]! // save registers
stp x2,x3,[sp,-16]! // save registers
stp x4,x5,[sp,-16]! // save registers
stp x6,x7,[sp,-16]! // save registers
mov x5,x0 // save buffer address
mov x6,x1 // save key text
// compute text length
mov x8,#0
1: // loop
ldrb w0,[x5,x8] // load a byte
cmp x0,#0 // end ?
add x9,x8,1
csel x8,x9,x8,ne
bne 1b // no -> loop
add x8,x8,x5 // compute text end
 
mov x7,#0
2: // compute length text key
ldrb w0,[x6,x7]
cmp x0,#0
add x9,x7,1
csel x7,x9,x7,ne
bne 2b
 
3: // loop to search niéme(x2) key text
mov x0,x5
mov x1,x6
bl rechercheSousChaine
cmp x0,#0
blt 100f
subs x2,x2,1
ble 31f
add x5,x5,x0
add x5,x5,x7
b 3b
31:
add x0,x0,x5 // add address text to index
add x3,x3,x0 // add offset
sub x3,x3,1
// and add length key text
add x3,x3,x7
cmp x3,x8 // > at text end
bge 98f
mov x0,0
4: // character loop copy
ldrb w2,[x3,x0]
strb w2,[x4,x0]
cbz x2,99f // text end ? return zero
cmp x0,48 // extraction length
beq 5f
add x0,x0,1
b 4b // and loop
5:
mov x2,0 // store final zéro
strb w2,[x4,x0]
add x0,x0,1
add x0,x0,x3 // x0 return the last position of extraction
// it is possible o search another text
b 100f
98:
mov x0,-1 // error
b 100f
99:
mov x0,0
100:
ldp x6,x7,[sp],16 // restaur 2 registers
ldp x4,x5,[sp],16 // restaur 2 registers
ldp x2,x3,[sp],16 // restaur 2 registers
ldp x1,lr,[sp],16 // restaur 2 registers
ret // return to address lr x30
/******************************************************************/
/* search substring in string */
/******************************************************************/
/* x0 contains address string */
/* x1 contains address substring */
/* x0 return start index substring or -1 if not find */
rechercheSousChaine:
stp x1,lr,[sp,-16]! // save registers
stp x2,x3,[sp,-16]! // save registers
stp x4,x5,[sp,-16]! // save registers
stp x6,x7,[sp,-16]! // save registers
mov x2,#0 // index position string
mov x3,#0 // index position substring
mov x6,#-1 // search index
ldrb w4,[x1,x3] // load first byte substring
cbz x4,99f // zero final ? error
1:
ldrb w5,[x0,x2] // load string byte
cbz x5,99f // zero final ? yes -> not found
cmp x5,x4 // compare character two strings
beq 2f
mov x6,-1 // not equal - > raz index
mov x3,0 // and raz byte counter
ldrb w4,[x1,x3] // and load byte
add x2,x2,1 // and increment byte counter
b 1b // and loop
2: // characters equal
cmp x6,-1 // first character equal ?
csel x6,x2,x6,eq // yes -> start index in x6
add x3,x3,1 // increment substring counter
ldrb w4,[x1,x3] // and load next byte
cbz x4,3f // zero final ? yes -> search end
add x2,x2,1 // else increment string index
b 1b // and loop
3:
mov x0,x6 // return start index substring in the string
b 100f
99:
mov x0,-1 // not found
100:
ldp x6,x7,[sp],16 // restaur 2 registers
ldp x4,x5,[sp],16 // restaur 2 registers
ldp x2,x3,[sp],16 // restaur 2 registers
ldp x1,lr,[sp],16 // restaur 2 registers
ret // return to address lr x30
/********************************************************/
/* File Include fonctions */
/********************************************************/
/* for this file see task include a file in language AArch64 assembly */
.include "../includeARM64.inc"
</syntaxhighlight>
{{Output}}
<pre>
Début du programme.
Extraction = Rosetta Code is a programming chrestomathy site.
Fin normale du programme.
</pre>
 
=={{header|ARM Assembly}}==
{{works with|as|Raspberry Pi}}
<syntaxhighlight lang="arm assembly">
/* ARM assembly Raspberry PI */
/* program yahoosearch.s */
/* access RosettaCode.org and data extract */
/* use openssl for access to port 443 */
/* test openssl : package libssl-dev */
 
/* REMARK 1 : this program use routines in a include file
see task Include a file language arm assembly
for the routine affichageMess conversion10
see at end of this program the instruction include */
 
/*******************************************/
/* Constantes */
/*******************************************/
.equ STDOUT, 1 @ Linux output console
.equ EXIT, 1 @ Linux syscall
.equ WRITE, 4 @ Linux syscall
.equ BRK, 0x2d @ Linux syscall
.equ CHARPOS, '@'
 
.equ EXIT, 1
.equ TAILLEBUFFER, 500
 
.equ SSL_OP_NO_SSLv3, 0x02000000
.equ SSL_OP_NO_COMPRESSION, 0x00020000
.equ SSL_MODE_AUTO_RETRY, 0x00000004
.equ SSL_CTRL_MODE, 33
 
.equ BIO_C_SET_CONNECT, 100
.equ BIO_C_DO_STATE_MACHINE, 101
.equ BIO_C_SET_SSL, 109
.equ BIO_C_GET_SSL, 110
 
.equ LGBUFFERREQ, 512001
.equ LGBUFFER2, 128001
 
/*********************************/
/* Initialized data */
/*********************************/
.data
szMessDebutPgm: .asciz "Début du programme. \n"
szRetourLigne: .asciz "\n"
szMessFinOK: .asciz "Fin normale du programme. \n"
szMessErreur: .asciz "Erreur !!!"
szMessExtractArea: .asciz "Extraction = "
szNomSite1: .asciz "search.yahoo.com:443" @ host name and port
szLibStart: .asciz ">Rosetta Code" @ search string
szNomrepCertif: .asciz "/pi/certificats"
szRequete1: .asciz "GET /search?p=\"Rosettacode.org\"&b=1 HTTP/1.1 \r\nHost: search.yahoo.com\r\nConnection: keep-alive\r\nContent-Type: text/plain\r\n\r\n"
/*********************************/
/* UnInitialized data */
/*********************************/
.bss
.align 4
sBufferreq: .skip LGBUFFERREQ
szExtractArea: .skip TAILLEBUFFER
stNewSSL: .skip 200
/*********************************/
/* code section */
/*********************************/
.text
.global main
main:
ldr r0,iAdrszMessDebutPgm
bl affichageMess @ start message
 
/* connexion host port 443 and send query */
bl envoiRequete
cmp r0,#-1
beq 99f @ error ?
 
bl analyseReponse
 
ldr r0,iAdrszMessFinOK @ end message
bl affichageMess
mov r0, #0 @ return code ok
b 100f
99:
ldr r0,iAdrszMessErreur @ error
bl affichageMess
mov r0, #1 @ return code error
b 100f
100:
mov r7,#EXIT @ program end
svc #0 @ system call
iAdrszMessDebutPgm: .int szMessDebutPgm
iAdrszMessFinOK: .int szMessFinOK
iAdrszMessErreur: .int szMessErreur
 
/*********************************************************/
/* connexion host port 443 and send query */
/*********************************************************/
envoiRequete:
push {r2-r8,lr} @ save registers
@*************************************
@ openSsl functions use *
@*************************************
@init ssl
bl OPENSSL_init_crypto
bl ERR_load_BIO_strings
mov r2, #0
mov r1, #0
mov r0, #2
bl OPENSSL_init_crypto
mov r2, #0
mov r1, #0
mov r0, #0
bl OPENSSL_init_ssl
cmp r0,#0
blt erreur
bl TLS_client_method
bl SSL_CTX_new
cmp r0,#0
ble erreur
mov r6,r0 @ save ctx
ldr r1,iFlag
bl SSL_CTX_set_options
mov r0,r6
mov r1,#0
ldr r2,iAdrszNomrepCertif
bl SSL_CTX_load_verify_locations
cmp r0,#0
ble erreur
mov r0,r6
bl BIO_new_ssl_connect
cmp r0,#0
ble erreur
mov r5,r0 @ save bio
mov r1,#BIO_C_GET_SSL
mov r2,#0
ldr r3,iAdrstNewSSL
bl BIO_ctrl
ldr r0,iAdrstNewSSL
ldr r0,[r0]
mov r1,#SSL_CTRL_MODE
mov r2,#SSL_MODE_AUTO_RETRY
mov r3,#0
bl SSL_ctrl
mov r0,r5 @ bio
mov r1,#BIO_C_SET_CONNECT
mov r2,#0
ldr r3,iAdrszNomSite1
bl BIO_ctrl
mov r0,r5 @ bio
mov r1,#BIO_C_DO_STATE_MACHINE
mov r2,#0
mov r3,#0
bl BIO_ctrl
@ compute query length
mov r2,#0
ldr r1,iAdrszRequete1 @ query
1:
ldrb r0,[r1,r2]
cmp r0,#0
addne r2,#1
bne 1b
@ send query
mov r0,r5 @ bio
@ r1 = address query
@ r2 = length query
mov r3,#0
bl BIO_write @ send query
cmp r0,#0
blt erreur
ldr r7,iAdrsBufferreq @ buffer address
2: @ begin loop to read datas
mov r0,r5 @ bio
mov r1,r7 @ buffer address
mov r2,#LGBUFFERREQ - 1
mov r3,#0
bl BIO_read
cmp r0,#0
ble 4f @ error ou pb server
add r7,r0
sub r2,r7,#6
ldr r2,[r2]
ldr r3,iCharEnd
cmp r2,r3 @ text end ?
beq 4f
mov r1,#0xFFFFFF @ delay loop
3:
subs r1,#1
bgt 3b
b 2b @ loop read other chunk
4: @ read end
//ldr r0,iAdrsBufferreq @ to display buffer response of the query
//bl affichageMess
mov r0, r5 @ close bio
bl BIO_free_all
mov r0,#0
b 100f
erreur: @ error display
ldr r1,iAdrszMessErreur
bl afficheerreur
mov r0,#-1 @ error code
b 100f
100:
pop {r2-r8,lr} @ restaur registers
bx lr
iAdrszRequete1: .int szRequete1
iAdrsBufferreq: .int sBufferreq
iFlag: .int SSL_OP_NO_SSLv3 | SSL_OP_NO_COMPRESSION
iAdrstNewSSL: .int stNewSSL
iAdrszNomSite1: .int szNomSite1
iAdrszNomrepCertif: .int szNomrepCertif
iCharEnd: .int 0x0A0D300A
/*********************************************************/
/* response analyze */
/*********************************************************/
analyseReponse:
push {r1-r4,lr} @ save registers
ldr r0,iAdrsBufferreq @ buffer address
ldr r1,iAdrszLibStart @ key text address
mov r2,#2 @ occurence key text
mov r3,#-11 @ offset
ldr r4,iAdrszExtractArea @ address result area
bl extChaine
cmp r0,#-1
beq 99f
ldr r0,iAdrszMessExtractArea
bl affichageMess
ldr r0,iAdrszExtractArea @ résult display
bl affichageMess
ldr r0,iAdrszRetourLigne
bl affichageMess
b 100f
99:
ldr r0,iAdrszMessErreur @ error
bl affichageMess
mov r0, #-1 @ error return code
b 100f
100:
pop {r1-r4,lr} @ restaur registers
bx lr
iAdrszLibStart: .int szLibStart
iAdrszExtractArea: .int szExtractArea
iAdrszMessExtractArea: .int szMessExtractArea
iAdrszRetourLigne: .int szRetourLigne
/*********************************************************/
/* Text Extraction behind text key */
/*********************************************************/
/* r0 buffer address */
/* r1 key text to search */
/* r2 number occurences to key text */
/* r3 offset */
/* r4 result address */
extChaine:
push {r2-r8,lr} @ save registers
mov r5,r0 @ save buffer address
mov r6,r1 @ save key text
@ compute text length
mov r7,#0
1: @ loop
ldrb r0,[r5,r7] @ load a byte
cmp r0,#0 @ end ?
addne r7,#1 @ no -> loop
bne 1b
add r7,r5 @ compute text end
 
mov r8,#0
2: @ compute length text key
ldrb r0,[r6,r8]
cmp r0,#0
addne r8,#1
bne 2b
 
3: @ loop to search nième(r2) key text
mov r0,r5
mov r1,r6
bl rechercheSousChaine
cmp r0,#0
blt 100f
subs r2,#1
addgt r5,r0
addgt r5,r8
bgt 3b
add r0,r5 @ add address text to index
add r3,r0 @ add offset
sub r3,#1
@ and add length key text
add r3,r8
cmp r3,r7 @ > at text end
movge r0,#-1 @ yes -> error
bge 100f
mov r0,#0
4: @ character loop copy
ldrb r2,[r3,r0]
strb r2,[r4,r0]
cmp r2,#0 @ text end ?
moveq r0,#0 @ return zero
beq 100f
cmp r0,#48 @ extraction length
beq 5f
add r0,#1
b 4b @ and loop
5:
mov r2,#0 @ store final zéro
strb r2,[r4,r0]
add r0,#1
add r0,r3 @ r0 return the last position of extraction
@ it is possible o search another text
100:
pop {r2-r8,lr} @ restaur registers
bx lr
 
/******************************************************************/
/* search substring in string */
/******************************************************************/
/* r0 contains address string */
/* r1 contains address substring */
/* r0 return start index substring or -1 if not find */
rechercheSousChaine:
push {r1-r6,lr} @ save registers
mov r2,#0 @ index position string
mov r3,#0 @ index position substring
mov r6,#-1 @ search index
ldrb r4,[r1,r3] @ load first byte substring
cmp r4,#0 @ zero final ?
moveq r0,#-1 @ error
beq 100f
1:
ldrb r5,[r0,r2] @ load string byte
cmp r5,#0 @ zero final ?
moveq r0,#-1 @ yes -> not find
beq 100f
cmp r5,r4 @ compare character two strings
beq 2f
mov r6,#-1 @ not equal - > raz index
mov r3,#0 @ and raz byte counter
ldrb r4,[r1,r3] @ and load byte
add r2,#1 @ and increment byte counter
b 1b @ and loop
2: @ characters equal
cmp r6,#-1 @ first character equal ?
moveq r6,r2 @ yes -> start index in r6
add r3,#1 @ increment substring counter
ldrb r4,[r1,r3] @ and load next byte
cmp r4,#0 @ zero final ?
beq 3f @ yes -> search end
add r2,#1 @ else increment string index
b 1b @ and loop
3:
mov r0,r6 @ return start index substring in the string
100:
pop {r1-r6,lr} @ restaur registres
bx lr
 
/***************************************************/
/* ROUTINES INCLUDE */
/***************************************************/
.include "../affichage.inc"
</syntaxhighlight>
{{Output}}
<pre>
Début du programme.
Extraction = Rosetta Code is a programming chrestomathy site.
Fin normale du programme.
</pre>
=={{header|AutoHotkey}}==
translated from python example
<syntaxhighlight lang="autohotkey">test:
<lang AutoHotkey>test:
yahooSearch("test", 1)
yahooSearch("test", 2)
Line 38 ⟶ 774:
url := regexreplace(url, "<.*?>")
return url
}</langsyntaxhighlight>
 
=={{header|C sharp}}==
Line 44 ⟶ 780:
E. g. all implementations for this task which regex for
"<a class=" fail by now, after Yahoo has changed its output format.
<langsyntaxhighlight lang="csharp">using System;
using System.Net;
using System.Text.RegularExpressions;
Line 157 ⟶ 893:
}
}
</syntaxhighlight>
</lang>
 
=={{header|D}}==
{{trans|C#}}
<langsyntaxhighlight lang="d">import std.stdio, std.exception, std.regex, std.algorithm, std.string,
std.net.curl;
 
Line 219 ⟶ 955:
void main() {
writefln("%(%s\n%)", "test".YahooSearch.results);
}</langsyntaxhighlight>
{{out|Output (shortened)}}
<pre>
Line 237 ⟶ 973:
 
=={{header|Gambas}}==
<langsyntaxhighlight lang="gambas">Public Sub Form_Open()
Dim hWebView As WebView
 
Line 248 ⟶ 984:
hWebView.URL = "https://www.yahoo.com"
 
End</langsyntaxhighlight>
'''[http://www.cogier.com/gambas/Yahoo!%20search%20interface.png Click here to see output (I have typed 'rosettacode' in the search box)]'''
 
=={{header|Go}}==
Yahoo! has evidently changed its search output format over the years and, if it is currently documented anywhere, then I couldn't find it.
 
The regular expression used below was figured out by studying the raw HTML and works fine as at 18th November, 2019.
<syntaxhighlight lang="go">package main
 
import (
"fmt"
"golang.org/x/net/html"
"io/ioutil"
"net/http"
"regexp"
"strings"
)
 
var (
expr = `<h3 class="title"><a class=.*?href="(.*?)".*?>(.*?)</a></h3>` +
`.*?<div class="compText aAbs" ><p class=.*?>(.*?)</p></div>`
rx = regexp.MustCompile(expr)
)
 
type YahooResult struct {
title, url, content string
}
 
func (yr YahooResult) String() string {
return fmt.Sprintf("Title : %s\nUrl : %s\nContent: %s\n", yr.title, yr.url, yr.content)
}
 
type YahooSearch struct {
query string
page int
}
 
func (ys YahooSearch) results() []YahooResult {
search := fmt.Sprintf("http://search.yahoo.com/search?p=%s&b=%d", ys.query, ys.page*10+1)
resp, _ := http.Get(search)
body, _ := ioutil.ReadAll(resp.Body)
s := string(body)
defer resp.Body.Close()
var results []YahooResult
for _, f := range rx.FindAllStringSubmatch(s, -1) {
yr := YahooResult{}
yr.title = html.UnescapeString(strings.ReplaceAll(strings.ReplaceAll(f[2], "<b>", ""), "</b>", ""))
yr.url = f[1]
yr.content = html.UnescapeString(strings.ReplaceAll(strings.ReplaceAll(f[3], "<b>", ""), "</b>", ""))
results = append(results, yr)
}
return results
}
 
func (ys YahooSearch) nextPage() YahooSearch {
return YahooSearch{ys.query, ys.page + 1}
}
 
func main() {
ys := YahooSearch{"rosettacode", 0}
// Limit output to first 5 entries, say, from pages 1 and 2.
fmt.Println("PAGE 1 =>\n")
for _, res := range ys.results()[0:5] {
fmt.Println(res)
}
fmt.Println("PAGE 2 =>\n")
for _, res := range ys.nextPage().results()[0:5] {
fmt.Println(res)
}
}</syntaxhighlight>
 
{{out}}
Note there is some repetition between the pages.
<pre>
PAGE 1 =>
 
Title : Rosetta Code
Url : https://rosettacode.org/wiki/Rosetta_Code
Content: Rosetta Code Rosetta Code is a programming chrestomathy site. Rosetta Code currently has 976 tasks, 231 draft tasks, and is aware of 756 languages, though we do not (and cannot) have solutions to every task in every language. 1 Places to start
 
Title : Rosetta Code - Wikipedia
Url : https://en.wikipedia.org/wiki/Rosetta_Code
Content: Rosetta Code is a wiki -based programming chrestomathy website with implementations of common algorithms and solutions to various programming problems in many different programming languages. 1 Website 1.1 Data and structure 1.2 Languages
 
Title : Rosetta Code (@rosettacode) | Twitter
Url : https://twitter.com/rosettacode
Content: The latest Tweets from Rosetta Code (@rosettacode). Twitter account for http://t.co/DuRZFWDfRn. The general idea here is for short announcements and the like. The ...
 
Title : Best of Rosettacode
Url : https://examples.p6c.dev/categories/best-of-rosettacode.html
Content: 99 Problems Rosettacode Cookbook Euler Games Interpreters Modules Other Grammars Perlmonks Rosalind Shootout ...
 
Title : Rosetta Code Blog
Url : https://blog.rosettacode.org/
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 ...
 
PAGE 2 =>
 
Title : Rosetta Code | R-bloggers
Url : https://www.r-bloggers.com/rosetta-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.
 
Title : Best of Rosettacode
Url : https://examples.p6c.dev/categories/best-of-rosettacode.html
Content: 99 Problems Rosettacode Cookbook Euler Games Interpreters Modules Other Grammars Perlmonks Rosalind Shootout ...
 
Title : Rosetta Code Blog
Url : https://blog.rosettacode.org/
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 ...
 
Title : What exactly is the purpose of Rosetta Code? - Quora
Url : https://www.quora.com/What-exactly-is-the-purpose-of-Rosetta-Code
Content: The name is a play on the Rosetta Stone. The Rosetta Stone featured a decree by King Ptolomy written in three scripts - Egyption hieroglyphs, Demotic, and Ancient Greek.
 
Title : One R Tip A Day: Rosetta Code
Url : https://onertipaday.blogspot.com/2009/07/rosetta-code.html
Content: Today I'd like to suggest the interesting Rosetta Code site: 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.
</pre>
 
=={{header|GUISS}}==
 
<langsyntaxhighlight lang="guiss">Start,Programs,Applications,Mozilla Firefox,Inputbox:address bar>www.yahoo.co.uk,
Button:Go,Area:browser window,Inputbox:searchbox>elephants,Button:Search</langsyntaxhighlight>
 
=={{header|Haskell}}==
Haskell is not an object oriented language, so this example does not implement an object class.
However, it can be interesting as an example of how HTML source code can be parsed using the Parsec library.
<langsyntaxhighlight Haskelllang="haskell">import Network.HTTP
import Text.Parsec
 
Line 364 ⟶ 1,216:
in [ YahooSearchItem { itemUrl = u, itemTitle = t, itemContent = c } |
(u, t, c) <- zip3 us ts cs ]
</syntaxhighlight>
</lang>
Simple invocation from GHCi: <pre>yahoo "Rosetta%20code" >>= printResults</pre>. Notice that spaces must be expressed as "%20", because spaces are not allowed in URLs.
==Icon and {{header|Unicon}}==
The following uses the Unicon pre-processor and messaging extensions and won't run under Icon without significant modification.
The code provides a suitable demonstration; however, could be made more robust by things such as URL escaping the search string
<langsyntaxhighlight Iconlang="icon">link printf,strings
 
procedure main()
Line 411 ⟶ 1,263:
urlpat := sprintf("http://search.yahoo.com/search?p=%s&b=%%d",searchtext)
page := 0
end</langsyntaxhighlight>
 
{{libheader|Icon Programming Library}}
Line 449 ⟶ 1,301:
osettaCode</b>) CALL transfers control to the first statement of a SUBROUTINE. C
ALL subroutine_name[argument1, ..."</pre>
 
=={{header|Java}}==
{{incorrect|Java}}
<langsyntaxhighlight lang="java">import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
Line 607 ⟶ 1,460:
}
}
}</langsyntaxhighlight>
 
=={{header|Julia}}==
<syntaxhighlight 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
currentpage::Int
usedpages::Vector{Int}
results::Vector{SearchResults}
end
YahooSearch(s, url = URI) = YahooSearch(s, url, 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
</syntaxhighlight>{{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}}==
{{incorrect|Kotlin}}
This is based on the C# entry but uses a regular expression based on what appears to be the Yahoo! format as at the date of this entry (4 December 2017).
<langsyntaxhighlight lang="scala">// version 1.2.0
 
import java.net.URL
Line 655 ⟶ 1,751:
for (result in x.results.take(3)) println(result)
}
}</langsyntaxhighlight>
Output (restricted to first three results on first two pages):
<pre>PAGE 1 =>
Line 685 ⟶ 1,781:
Text : Last week Christian Drumm (@ceedee666) and Fred Verheul (@fredverheul) had a short conversation on ...</pre>
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
We cannot define a class in Mathematica, so I generate a "Manipulate" object instead.
<syntaxhighlight lang="text">Manipulate[
Column[Flatten[
StringCases[
Line 711 ⟶ 1,807:
Row[{Button["Search", page = 1; query = input],
Button["Prev", page -= 10, Enabled -> Dynamic[page >= 10]],
Button["Next", page += 10]}]]</langsyntaxhighlight>
 
=={{header|Nim}}==
<syntaxhighlight lang="nim">import httpclient, strutils, htmlparser, xmltree, strtabs
const
PageSize = 7
YahooURLPattern = "https://search.yahoo.com/search?fr=opensearch&b=$$#&pz=$#&p=".format(PageSize)
type
SearchResult = ref object
url, title, content: string
SearchInterface = ref object
client: HttpClient
urlPattern: string
page: int
results: array[PageSize+2, SearchResult]
proc newSearchInterface(question: string): SearchInterface =
new result
result.client = newHttpClient()
# result.client = newHttpClient(proxy = newProxy(
# "http://localhost:40001")) # only http_proxy supported
result.urlPattern = YahooURLPattern&question
proc search(si: SearchInterface) =
let html = parseHtml(si.client.getContent(si.urlPattern.format(
si.page*PageSize+1)))
var
i: int
attrs: XmlAttributes
for d in html.findAll("div"):
attrs = d.attrs
if attrs != nil and attrs.getOrDefault("class").startsWith("dd algo algo-sr relsrch"):
let d_inner = d.child("div")
for a in d_inner.findAll("a"):
attrs = a.attrs
if attrs != nil and attrs.getOrDefault("class") == " ac-algo fz-l ac-21th lh-24":
si.results[i] = SearchResult(url: attrs["href"], title: a.innerText,
content: d.findAll("p")[0].innerText)
i+=1
break
while i < len(si.results) and si.results[i] != nil:
si.results[i] = nil
i+=1
proc nextPage(si: SearchInterface) =
si.page+=1
si.search()
 
proc echoResult(si: SearchInterface) =
for res in si.results:
if res == nil:
break
echo(res[])
 
var searchInf = newSearchInterface("weather")
searchInf.search()
searchInf.echoResult()
echo("searching for next page...")
searchInf.nextPage()
searchInf.echoResult()
</syntaxhighlight>
{{out}}
<pre>(url: "https://weather.com/", title: "National and Local Weather Radar, Daily Forecast, Hurricane ...", content: "The Weather Channel and weather.com provide a national and local weather forecast for cities, as well as weather radar, report and hurricane coverage ")
(url: "https://weather.com/weather/tenday/l/California+MO?canonicalCityId=d58964aa4d5c9ba2a8e76fe9175052ef5d1ed9ee98eb5514e2b58d67722f7e0e", title: "California, MO 10-Day Weather Forecast - The Weather Channel ...", content: "Be prepared with the most accurate 10-day forecast for California, MO with highs, lows, chance of precipitation from The Weather Channel and Weather.com ")
(url: "https://www.accuweather.com/", title: "Local, National, & Global Daily Weather Forecast | AccuWeather", content: "AccuWeather has local and international weather forecasts from the most accurate weather forecasting technology featuring up to the minute weather reports ")
(url: "https://www.weather.gov/", title: "National Weather Service", content: "Surface Weather Upper Air Marine and Buoy Reports Snow Cover Satellite Space Weather International Observations. FORECAST Local Forecast International Forecasts Severe Weather Current Outlook Maps Drought Fire Weather Fronts/Precipitation Maps Current Graphical Forecast Maps Rivers Marine Offshore and High Seas Hurricanes Aviation Weather ")
(url: "https://www.wunderground.com/", title: "Local Weather Forecast, News and Conditions | Weather Underground", content: "Weather Underground provides local & long-range weather forecasts, weather reports, maps & tropical weather conditions for locations worldwide ")
(url: "https://graphical.weather.gov/sectors/missouri.php", title: "NOAA Graphical Forecast for Missouri - National Weather Service", content: "National Weather Service 1325 East West Highway Silver Spring, MD 20910 Page Author: NWS Internet Services Team: Disclaimer Information Quality Credits ... ")
(url: "https://www.weatherbug.com/weather-forecast/now/macon-mo-63552", title: "Macon, Missouri | Current Weather Forecasts, Live Radar Maps ...", content: "For more than 20 years Earth Networks has operated the world’s largest and most comprehensive weather observation, lightning detection, and climate networks. We are now leveraging our big data smarts to deliver on the promise of IoT. ")
(url: "https://www.accuweather.com/en/us/lakeview-heights-mo/65338/weather-forecast/2107359", title: "Lakeview Heights, MO Today, Tonight & Tomorrow\'s Weather ...", content: "Get the forecast for today, tonight & tomorrow\'s weather for Lakeview Heights, MO. Hi/Low, RealFeel®, precip, radar, & everything you need to be ready for the day, commute, and weekend! ")
(url: "https://www.wunderground.com/forecast/us/az/tucson", title: "Tucson, AZ 10-Day Weather Forecast | Weather Underground", content: "Tucson Weather Forecasts. Weather Underground provides local & long-range weather forecasts, weatherreports, maps & tropical weather conditions for the Tucson area. ")
searching for next page...
(url: "https://forecast.weather.gov/", title: "National Weather Service", content: "NOAA National Weather Service National Weather Service. Widespread Heat This Week; Monsoon Rain Lingers. Widespread heat concerns are expected through at least midweek as high pressure covers a large portion of the U.S., especially the Central half. ")
(url: "https://weather.com/weather/tenday/l/Port+Huron+MI?canonicalCityId=772884de37d69a70824031f9ab1202b956e665bdf14a6ffd3257184d64d33351", title: "Port Huron, MI 10-Day Weather Forecast - The Weather Channel ...", content: "Be prepared with the most accurate 10-day forecast for Port Huron, MI with highs, lows, chance of precipitation from The Weather Channel and Weather.com ")
(url: "https://www.weather.gov/sgx/", title: "San Diego, CA - National Weather Service", content: "Jul 17, 2021 · NOAA National Weather Service San Diego, CA. Seasonable temperatures will be felt tonight with low cloudiness along the coast and into the valleys with a mostly clear sky inland. ")
(url: "https://www.weatherbug.com/weather-forecast/now/houston-tx-77007", title: "Houston, Texas | Current Weather Forecasts, Live Radar Maps ...", content: "For more than 20 years Earth Networks has operated the world’s largest and most comprehensive weather observation, lightning detection, and climate networks. We are now leveraging our big data smarts to deliver on the promise of IoT. ")
(url: "https://www.msn.com/en-us/weather", title: "MSN", content: "Sunny. There will be mostly sunny skies. The high will be 103°. Feels Like. 65°. Air Quality. Moderate air ( 51 - 100) Primary pollutant PM2.5 11 μg/m³. 52. ")
(url: "https://www.noaa.gov/weather", title: "Weather | National Oceanic and Atmospheric Administration", content: "Jun 04, 2021 · Weather, water and climate events, cause an average of approximately 650 deaths and $15 billion in damage per year and are responsible for some 90 percent of all presidentially-declared disasters. About one-third of the U.S. economy – some $3 trillion – is sensitive to weather and climate. ")
(url: "https://www.nbcphiladelphia.com/weather/", title: "NBC10 Philadelphia – Philadelphia News, Local News, Weather ...", content: "Weather stories. severe weather 3 mins ago ‘Destructive Damage\' to Be Added to National Weather Service Cell Phone Alerts weather 5 hours ago Today\'s NBC10 First Alert Forecast ... ")</pre>
 
=={{header|Oz}}==
Line 719 ⟶ 1,890:
 
We implement some simple parsing with logic programming. Regular expressions in Oz don't seem to support lazy quantification which makes parsing the result pages with them difficult.
<langsyntaxhighlight lang="oz">declare
[HTTPClient] = {Module.link ['x-ozlib://mesaros/net/HTTPClient.ozf']}
[StringX] = {Module.link ['x-oz://system/String.ozf']}
Line 865 ⟶ 2,036:
end
in
{ExampleUsage}</langsyntaxhighlight>
 
=={{header|Perl}}==
<langsyntaxhighlight lang="perl">package YahooSearch;
 
use Encode;
Line 935 ⟶ 2,106:
$invocant->{link_to_next} = $next;
$invocant->{results} = $results;
return 1;}</langsyntaxhighlight>
 
=={{header|Perl6Phix}}==
{{libheader|Phix/libcurl}}
As noted elsewhere, Yahoo and other search sites will regularly change the output format, so don't be too shocked if this is once again broken. Last fixed 22/4/2022 (with previous left in as comments).
The glyphs constants do not show up properly on rosettacode, so here they are in plain text, and I even had to edit that by hand:
<pre>
constant glyphs = {{"\xC2\xB7 ","*"}, -- bullet point
{"&amp;#39;",`'`}, -- single quote
{"&amp;quot;",`"`}, -- double quote
{"&amp;amp;","&"}, -- ampersand
{"\xE2\x94\xAC\xC2\xAB","[R]"}, -- registered
{"\xC2\xAE","[R]"}}, -- registered
</pre>
<!--<syntaxhighlight lang="phix">(notonline)-->
<span style="color: #000080;font-style:italic;">--
-- demo\rosetta\Yahoo_search_interface.exw
-- =======================================
--</span>
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span> <span style="color: #000080;font-style:italic;">-- (libcurl)</span>
<span style="color: #008080;">include</span> <span style="color: #000000;">builtins</span><span style="color: #0000FF;">\</span><span style="color: #000000;">libcurl</span><span style="color: #0000FF;">.</span><span style="color: #000000;">e</span>
<span style="color: #008080;">constant</span> <span style="color: #000000;">glyphs</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{{</span><span style="color: #008000;">"\xC2\xB7 "</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"*"</span><span style="color: #0000FF;">},</span> <span style="color: #000080;font-style:italic;">-- bullet point</span>
<span style="color: #0000FF;">{</span><span style="color: #008000;">"&#39;"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">`'`</span><span style="color: #0000FF;">},</span> <span style="color: #000080;font-style:italic;">-- single quote</span>
<span style="color: #0000FF;">{</span><span style="color: #008000;">"&quot;"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">`"`</span><span style="color: #0000FF;">},</span> <span style="color: #000080;font-style:italic;">-- double quote</span>
<span style="color: #0000FF;">{</span><span style="color: #008000;">"&amp;"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"&"</span><span style="color: #0000FF;">},</span> <span style="color: #000080;font-style:italic;">-- ampersand</span>
<span style="color: #0000FF;">{</span><span style="color: #008000;">"\xE2\x94\xAC\xC2\xAB"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"[R]"</span><span style="color: #0000FF;">},</span> <span style="color: #000080;font-style:italic;">-- registered</span>
<span style="color: #0000FF;">{</span><span style="color: #008000;">"\xC2\xAE"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"[R]"</span><span style="color: #0000FF;">}},</span> <span style="color: #000080;font-style:italic;">-- registered</span>
<span style="color: #0000FF;">{</span><span style="color: #000000;">gutf8</span><span style="color: #0000FF;">,</span><span style="color: #000000;">gascii</span><span style="color: #0000FF;">}</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">columnize</span><span style="color: #0000FF;">(</span><span style="color: #000000;">glyphs</span><span style="color: #0000FF;">),</span>
<span style="color: #000000;">tags</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{{</span><span style="color: #008000;">`&lt;a `</span><span style="color: #0000FF;">,</span><span style="color: #008000;">`&lt;/a&gt;`</span><span style="color: #0000FF;">},</span>
<span style="color: #0000FF;">{</span><span style="color: #008000;">`&lt;b&gt;`</span><span style="color: #0000FF;">,</span><span style="color: #008000;">`&lt;/b&gt;`</span><span style="color: #0000FF;">},</span>
<span style="color: #0000FF;">{</span><span style="color: #008000;">`&lt;span class=" fc-2nd"&gt;`</span><span style="color: #0000FF;">,</span><span style="color: #008000;">`&lt;/span&gt;`</span><span style="color: #0000FF;">}}</span>
<span style="color: #008080;">function</span> <span style="color: #000000;">grab</span><span style="color: #0000FF;">(</span><span style="color: #004080;">string</span> <span style="color: #000000;">txt</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">opener</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">closer</span><span style="color: #0000FF;">,</span> <span style="color: #004080;">integer</span> <span style="color: #000000;">tdx</span><span style="color: #0000FF;">,</span> <span style="color: #004080;">bool</span> <span style="color: #000000;">crop</span><span style="color: #0000FF;">)</span>
<span style="color: #004080;">integer</span> <span style="color: #000000;">openidx</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">match</span><span style="color: #0000FF;">(</span><span style="color: #000000;">opener</span><span style="color: #0000FF;">,</span><span style="color: #000000;">txt</span><span style="color: #0000FF;">,</span><span style="color: #000000;">tdx</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">if</span> <span style="color: #000000;">openidx</span><span style="color: #0000FF;">=</span><span style="color: #000000;">0</span> <span style="color: #008080;">then</span> <span style="color: #008080;">return</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">0</span><span style="color: #0000FF;">,</span><span style="color: #008000;">""</span><span style="color: #0000FF;">}</span> <span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #004080;">integer</span> <span style="color: #000000;">closeidx</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">match</span><span style="color: #0000FF;">(</span><span style="color: #000000;">closer</span><span style="color: #0000FF;">,</span><span style="color: #000000;">txt</span><span style="color: #0000FF;">,</span><span style="color: #000000;">openidx</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">txt</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">txt</span><span style="color: #0000FF;">[</span><span style="color: #000000;">openidx</span><span style="color: #0000FF;">+</span><span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">opener</span><span style="color: #0000FF;">)..</span><span style="color: #000000;">closeidx</span><span style="color: #0000FF;">-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">]</span>
<span style="color: #000000;">tdx</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">1</span>
<span style="color: #008080;">while</span> <span style="color: #000000;">tdx</span><span style="color: #0000FF;"><=</span><span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">tags</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">do</span>
<span style="color: #0000FF;">{</span><span style="color: #000000;">opener</span><span style="color: #0000FF;">,</span><span style="color: #000000;">closer</span><span style="color: #0000FF;">}</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">tags</span><span style="color: #0000FF;">[</span><span style="color: #000000;">tdx</span><span style="color: #0000FF;">]</span>
<span style="color: #004080;">integer</span> <span style="color: #000000;">i</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">match</span><span style="color: #0000FF;">(</span><span style="color: #000000;">opener</span><span style="color: #0000FF;">,</span><span style="color: #000000;">txt</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">if</span> <span style="color: #000000;">i</span><span style="color: #0000FF;">=</span><span style="color: #000000;">0</span> <span style="color: #008080;">then</span>
<span style="color: #000000;">tdx</span> <span style="color: #0000FF;">+=</span> <span style="color: #000000;">1</span>
<span style="color: #008080;">else</span>
<span style="color: #008080;">if</span> <span style="color: #000000;">opener</span><span style="color: #0000FF;">[$]=</span><span style="color: #008000;">'&gt;'</span> <span style="color: #008080;">then</span>
<span style="color: #000000;">txt</span><span style="color: #0000FF;">[</span><span style="color: #000000;">i</span><span style="color: #0000FF;">..</span><span style="color: #000000;">i</span><span style="color: #0000FF;">+</span><span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">opener</span><span style="color: #0000FF;">)-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">]</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">""</span>
<span style="color: #008080;">else</span>
<span style="color: #000000;">txt</span><span style="color: #0000FF;">[</span><span style="color: #000000;">i</span><span style="color: #0000FF;">..</span><span style="color: #7060A8;">find</span><span style="color: #0000FF;">(</span><span style="color: #008000;">'&gt;'</span><span style="color: #0000FF;">,</span><span style="color: #000000;">txt</span><span style="color: #0000FF;">,</span><span style="color: #000000;">i</span><span style="color: #0000FF;">)]</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">""</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #000000;">i</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">match</span><span style="color: #0000FF;">(</span><span style="color: #000000;">closer</span><span style="color: #0000FF;">,</span><span style="color: #000000;">txt</span><span style="color: #0000FF;">,</span><span style="color: #000000;">i</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">txt</span><span style="color: #0000FF;">[</span><span style="color: #000000;">i</span><span style="color: #0000FF;">..</span><span style="color: #000000;">i</span><span style="color: #0000FF;">+</span><span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">closer</span><span style="color: #0000FF;">)-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">]</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">""</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">while</span>
<span style="color: #000000;">txt</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">substitute_all</span><span style="color: #0000FF;">(</span><span style="color: #000000;">txt</span><span style="color: #0000FF;">,</span><span style="color: #000000;">gutf8</span><span style="color: #0000FF;">,</span><span style="color: #000000;">gascii</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">if</span> <span style="color: #000000;">crop</span> <span style="color: #008080;">and</span> <span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">txt</span><span style="color: #0000FF;">)></span><span style="color: #000000;">80</span> <span style="color: #008080;">then</span> <span style="color: #000000;">txt</span><span style="color: #0000FF;">[</span><span style="color: #000000;">78</span><span style="color: #0000FF;">..$]</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">".."</span> <span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #008080;">return</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">closeidx</span><span style="color: #0000FF;">+</span><span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">closer</span><span style="color: #0000FF;">),</span><span style="color: #000000;">txt</span><span style="color: #0000FF;">}</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
<span style="color: #008080;">procedure</span> <span style="color: #000000;">YahooSearch</span><span style="color: #0000FF;">(</span><span style="color: #004080;">string</span> <span style="color: #000000;">query</span><span style="color: #0000FF;">,</span> <span style="color: #004080;">integer</span> <span style="color: #000000;">page</span><span style="color: #0000FF;">=</span><span style="color: #000000;">1</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Page %d:\n=======\n"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">page</span><span style="color: #0000FF;">)</span>
<span style="color: #004080;">string</span> <span style="color: #000000;">url</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">sprintf</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"https://search.yahoo.com/search?p=%s&b=%d"</span><span style="color: #0000FF;">,</span> <span style="color: #0000FF;">{</span><span style="color: #000000;">query</span><span style="color: #0000FF;">,</span> <span style="color: #0000FF;">(</span><span style="color: #000000;">page</span><span style="color: #0000FF;">-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">)*</span><span style="color: #000000;">10</span><span style="color: #0000FF;">+</span><span style="color: #000000;">1</span><span style="color: #0000FF;">})</span>
<span style="color: #000080;font-style:italic;">--?url</span>
<span style="color: #004080;">object</span> <span style="color: #000000;">res</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">curl_easy_perform_ex</span><span style="color: #0000FF;">(</span><span style="color: #000000;">url</span><span style="color: #0000FF;">)</span>
<span style="color: #000080;font-style:italic;">--?res</span>
<span style="color: #008080;">if</span> <span style="color: #008080;">not</span> <span style="color: #004080;">string</span><span style="color: #0000FF;">(</span><span style="color: #000000;">res</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">then</span>
<span style="color: #0000FF;">?{</span><span style="color: #008000;">"some error"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">res</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">curl_easy_strerror</span><span style="color: #0000FF;">(</span><span style="color: #000000;">res</span><span style="color: #0000FF;">)}</span>
<span style="color: #008080;">return</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #004080;">integer</span> <span style="color: #000000;">rdx</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">1</span>
<span style="color: #004080;">string</span> <span style="color: #000000;">title</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">link</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">desc</span>
<span style="color: #008080;">while</span> <span style="color: #004600;">true</span> <span style="color: #008080;">do</span>
<span style="color: #000080;font-style:italic;">-- {rdx,title} = grab(res,`&lt;h3 class="title ov-h"&gt;`,`&lt;/h3&gt;`,rdx)
-- {rdx,title} = grab(res,`&lt;span class=" d-ib p-abs t-0 l-0 fz-14 lh-20 fc-obsidian wr-bw ls-n pb-4"&gt;`,`&lt;/span&gt;`,rdx)</span>
<span style="color: #0000FF;">{</span><span style="color: #000000;">rdx</span><span style="color: #0000FF;">,</span><span style="color: #000000;">title</span><span style="color: #0000FF;">}</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">grab</span><span style="color: #0000FF;">(</span><span style="color: #000000;">res</span><span style="color: #0000FF;">,</span><span style="color: #008000;">`&lt;h3 style="display:block;margin-top:24px;margin-bottom:2px;" class="title"&gt;`</span><span style="color: #0000FF;">,</span><span style="color: #008000;">`&lt;/h3&gt;`</span><span style="color: #0000FF;">,</span><span style="color: #000000;">rdx</span><span style="color: #0000FF;">,</span><span style="color: #004600;">false</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">if</span> <span style="color: #000000;">rdx</span><span style="color: #0000FF;">=</span><span style="color: #000000;">0</span> <span style="color: #008080;">then</span> <span style="color: #008080;">exit</span> <span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #000080;font-style:italic;">-- {rdx,title} = grab(res,`&lt;/span&gt;`,`&lt;/a&gt;`,rdx)
-- title = title[rmatch(`&lt;/span&gt;`,title)+7..rmatch(`&lt;\a&gt;`,title)]</span>
<span style="color: #000000;">title</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">title</span><span style="color: #0000FF;">[</span><span style="color: #7060A8;">rmatch</span><span style="color: #0000FF;">(</span><span style="color: #008000;">`&lt;/span&gt;`</span><span style="color: #0000FF;">,</span><span style="color: #000000;">title</span><span style="color: #0000FF;">)+</span><span style="color: #000000;">7</span><span style="color: #0000FF;">..$]</span>
<span style="color: #000080;font-style:italic;">-- {rdx,link} = grab(res,`&lt;span class=" fz-ms fw-m fc-12th wr-bw lh-17"&gt;`,`&lt;/span&gt;`,rdx)</span>
<span style="color: #0000FF;">{</span><span style="color: #000000;">rdx</span><span style="color: #0000FF;">,</span><span style="color: #000000;">link</span><span style="color: #0000FF;">}</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">grab</span><span style="color: #0000FF;">(</span><span style="color: #000000;">res</span><span style="color: #0000FF;">,</span><span style="color: #008000;">`&lt;span&gt;`</span><span style="color: #0000FF;">,</span><span style="color: #008000;">`&lt;/span&gt;`</span><span style="color: #0000FF;">,</span><span style="color: #000000;">rdx</span><span style="color: #0000FF;">,</span><span style="color: #004600;">true</span><span style="color: #0000FF;">)</span>
<span style="color: #000080;font-style:italic;">-- {rdx,desc} = grab(res,`&lt;p class="fz-ms lh-1_43x"&gt;`,`&lt;/p&gt;`,rdx)</span>
<span style="color: #0000FF;">{</span><span style="color: #000000;">rdx</span><span style="color: #0000FF;">,</span><span style="color: #000000;">desc</span><span style="color: #0000FF;">}</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">grab</span><span style="color: #0000FF;">(</span><span style="color: #000000;">res</span><span style="color: #0000FF;">,</span><span style="color: #008000;">`&lt;span class=" fc-falcon"&gt;`</span><span style="color: #0000FF;">,</span><span style="color: #008000;">`&lt;/span&gt;`</span><span style="color: #0000FF;">,</span><span style="color: #000000;">rdx</span><span style="color: #0000FF;">,</span><span style="color: #004600;">true</span><span style="color: #0000FF;">)</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"title:%s\nlink:%s\ndesc:%s\n\n"</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">title</span><span style="color: #0000FF;">,</span><span style="color: #000000;">link</span><span style="color: #0000FF;">,</span><span style="color: #000000;">desc</span><span style="color: #0000FF;">})</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">while</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">procedure</span>
<span style="color: #000000;">YahooSearch</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"rosettacode"</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">YahooSearch</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"rosettacode"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">2</span><span style="color: #0000FF;">)</span>
<span style="color: #0000FF;">?</span><span style="color: #008000;">"done"</span>
<span style="color: #0000FF;">{}</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">wait_key</span><span style="color: #0000FF;">()</span>
<!--</syntaxhighlight>-->
{{out}}
<pre>
Page 1:
=======
title:Rosetta Code
link:rosettacode.org
desc:Jan 29, 2016 * Rosetta Code is a programming chrestomathy site. The idea is t..
 
title:Rosetta Code - Wikipedia
{{libheader|Gumbo}}
link:en.wikipedia.org/wiki/Rosetta_Code
{{libheader|LWP-Simple}}
desc:Rosetta Code is a wiki -based programming website with implementations of com..
{{libheader|exemel}}
 
title:@rosettacode | Twitter
YahooSearch.pm6:
link:twitter.com/rosettacode
desc:The latest tweets from @rosettacode
 
title:Rosetta Code - Simple English Wikipedia, the free encyclopedia
<lang Perl6>
link:simple.wikipedia.org/wiki/Rosetta_Code
use Gumbo;
desc:Rosetta Code is a wiki-based website that features ways to solve various prog..
use LWP::Simple;
use XML::Text;
 
<snip>
class YahooSearch {
has $!dom;
 
Page 2:
submethod BUILD (:$!dom) { }
=======
title:Category:Guile - Rosetta Code
link:rosettacode.org/wiki/Category:Guile
desc:May 30, 2020 * Listed below are all of the tasks on Rosetta Code which have b..
 
title:Rosetta Code - c2.com
method new($term) {
link:wiki.c2.com/?RosettaCode
self.bless(
desc:Rosetta Code is a repository for code examples that go beyond the traditional..
dom => parse-html(
LWP::Simple.get("http://search.yahoo.com/search?p={ $term }")
)
);
}
 
<snip>
method next {
$!dom = parse-html(
LWP::Simple.get(
$!dom.lookfor( TAG => 'a', class => 'next' ).head.attribs<href>
)
);
self;
}
 
title:Rosetta Stone | Discovery, History, & Facts | Britannica
method text ($node) {
link:www.britannica.com/topic/Rosetta-Stone
return '' unless $node;
desc:Rosetta Stone, ancient Egyptian stone bearing inscriptions in several languag..
return $node.text if $node ~~ XML::Text;
</pre>
 
$node.nodes.map({ self.text($_).trim }).join(' ');
}
 
method results {
state $n = 0;
for $!dom.lookfor( TAG => 'h3', class => 'title') {
given .lookfor( TAG => 'a' )[0] {
next unless $_; # No Link
next if .attribs<href> ~~ / ^ 'https://r.search.yahoo.com' /; # Ad
say "=== #{ ++$n } ===";
say "Title: { .contents[0] ?? self.text( .contents[0] ) !! '' }";
say " URL: { .attribs<href> }";
 
my $pt = .parent.parent.parent.elements( TAG => 'div' ).tail;
say " Text: { self.text($pt) }";
}
};
}
self
}
 
sub MAIN (Str $search-term) is export {
YahooSearch.new($search-term).results.next.results;
}
</lang>
 
And the invocation script is simply:
 
yahoo-search.pl6
<lang>use YahooSearch;</lang>
 
So:
<lang>perl6 yahoo-search.pl6 test</lang>
 
Should give out something like the following:
 
=={{header|PicoLisp}}==
<langsyntaxhighlight PicoLisplang="picolisp">(load "@lib/http.l")
 
(de yahoo (Query Page)
Line 1,037 ⟶ 2,263:
(T (eof))
(T (= "</div" (till ">" T)))
(char) ) ) ) ) ) ) ) ) ) )</langsyntaxhighlight>
Output:
<pre>: (more (yahoo "test"))
Line 1,047 ⟶ 2,273:
 
=={{header|Python}}==
<langsyntaxhighlight lang="python">import urllib
import re
 
Line 1,091 ⟶ 2,317:
for result in x.search_results:
print result.title</langsyntaxhighlight>
 
=={{header|R}}==
Line 1,099 ⟶ 2,325:
 
Rather than using regexes to find the content (like some of the other solutions here) this method parses the HTML and finds the appropriate sections.
<langsyntaxhighlight Rlang="r">YahooSearch <- function(query, page=1, .opts=list(), ignoreMarkUpErrors=TRUE)
{
if(!require(RCurl) || !require(XML))
Line 1,188 ⟶ 2,414:
#Usage
YahooSearch("rosetta code")
nextpage()</langsyntaxhighlight>
 
=={{header|Racket}}==
<langsyntaxhighlight Racketlang="racket">#lang racket
(require net/url)
(define *yaho-url* "http://search.yahoo.com/search?p=~a&b=~a")
Line 1,219 ⟶ 2,445:
(define (next-page)
(set! *current-page* (add1 *current-page*))
(search-yahoo *current-query*))</langsyntaxhighlight>
 
# REPL:
Line 1,286 ⟶ 2,512:
Text: Whether your are playing Greek number mode or Egyptian letter mode, the number one rule to keep in mind is keeping the scales balanced but its not that ...
</pre>
 
=={{header|Raku}}==
(formerly Perl 6)
 
{{libheader|Gumbo}}
{{libheader|LWP-Simple}}
{{libheader|exemel}}
 
 
YahooSearch.rakumod:
 
<syntaxhighlight lang="raku" line>
use Gumbo;
use LWP::Simple;
use XML::Text;
 
class YahooSearch {
has $!dom;
 
submethod BUILD (:$!dom) { }
 
method new($term) {
self.bless(
dom => parse-html(
LWP::Simple.get("http://search.yahoo.com/search?p={ $term }")
)
);
}
 
method next {
$!dom = parse-html(
LWP::Simple.get(
$!dom.lookfor( TAG => 'a', class => 'next' ).head.attribs<href>
)
);
self;
}
 
method text ($node) {
return '' unless $node;
return $node.text if $node ~~ XML::Text;
 
$node.nodes.map({ self.text($_).trim }).join(' ');
}
 
method results {
state $n = 0;
for $!dom.lookfor( TAG => 'h3', class => 'title') {
given .lookfor( TAG => 'a' )[0] {
next unless $_; # No Link
next if .attribs<href> ~~ / ^ 'https://r.search.yahoo.com' /; # Ad
say "=== #{ ++$n } ===";
say "Title: { .contents[0] ?? self.text( .contents[0] ) !! '' }";
say " URL: { .attribs<href> }";
 
my $pt = .parent.parent.parent.elements( TAG => 'div' ).tail;
say " Text: { self.text($pt) }";
}
}
self;
}
 
}
 
sub MAIN (Str $search-term) is export {
YahooSearch.new($search-term).results.next.results;
}
</syntaxhighlight>
 
And the invocation script is simply:
 
yahoo-search.raku
use YahooSearch;
 
So:
raku yahoo-search.raku test
 
Should give out something like the following:
<syntaxhighlight lang="text">
=== #1 ===
Title:
URL: https://www.speedtest.net/
Text: At Ookla, we are committed to ensuring that individuals with disabilities can access all of the content at www.speedtest.net. We also strive to make all content in Speedtest apps accessible. If you are having trouble accessing www.speedtest.net or Speedtest apps, please email legal@ziffdavis.com for assistance. Please put "ADA Inquiry" in the ...
=== #2 ===
Title: Test | Definition of Test by Merriam-Webster
URL: https://www.merriam-webster.com/dictionary/test
Text: Test definition is - a means of testing: such as. How to use test in a sentence.
=== #3 ===
Title: - Video Results
URL: https://video.search.yahoo.com/search/video?p=test
Text: More Test videos
</syntaxhighlight>
 
...and should go up to result #21!
 
=={{header|Ruby}}==
{{improve|1=Ruby|2=Should not call <code>URI.escape</code>, because it fails to encode = signs and some other characters that might appear in the term. See [[URL encoding#Ruby]].}}
Uses {{libheader|RubyGems}} {{libheader|Hpricot}} to parse the HTML. Someone more skillful than I at XPath or CSS could tighten up the <code>parse_html</code> method.
<langsyntaxhighlight lang="ruby">require 'open-uri'
require 'hpricot'
 
Line 1,351 ⟶ 2,672:
puts result.content
puts
end</langsyntaxhighlight>
 
=={{header|Run BASIC}}==
<langsyntaxhighlight lang="runbasic">'--------------------------------------------------------------------------
' send this from the server to the clients browser
'--------------------------------------------------------------------------
Line 1,391 ⟶ 2,712:
[exit]
cls ' clear browser screen and get outta here
wait</langsyntaxhighlight>
This user input sits at the top of the yahoo page so they can select a new search or page
<div>[[File:yahooSearchRunBasic.png‎]]</div>
Line 1,398 ⟶ 2,719:
{{trans|Python}}
 
<langsyntaxhighlight lang="tcl">package require http
 
proc fix s {
Line 1,435 ⟶ 2,756:
foreach {title content url} [Nextpage] {
puts $title
}</langsyntaxhighlight>
{{works with|Tcl|8.6}}
With Tcl 8.6, more options are available for managing the global state, through objects and coroutines. First, an object-based solution that takes the basic <tt>YahooSearch</tt> functionality and dresses it up to be more Tcl-like:
<langsyntaxhighlight lang="tcl">package require Tcl 8.6
 
oo::class create WebSearcher {
Line 1,471 ⟶ 2,792:
puts "\"$title\" : $url"
}
$ytest delete ;# standard method that deletes the object</langsyntaxhighlight>
However, the paradigm of an iterator is also interesting and is more appropriately supported through a coroutine. This version conceals the fact that the service produces output in pages; care should be taken with it because it can produce rather a lot of network traffic...
<langsyntaxhighlight lang="tcl">package require Tcl 8.6
 
proc yahoo! term {
Line 1,495 ⟶ 2,816:
puts [dict get [$it] title]
after 300 ;# Slow the code down... :-)
}</langsyntaxhighlight>
 
Another approach: uses a class as specified in the task. Also, uses an html parser from tcllib (parsing html with regular expressions is a particular annoyance of [[User:Glennj|mine]]).
Line 1,502 ⟶ 2,823:
{{tcllib|htmlparse}}
{{tcllib|textutil::adjust}}<!-- for formatting output -->
<langsyntaxhighlight lang="tcl">package require Tcl 8.6
package require http
package require htmlparse
Line 1,615 ⟶ 2,936:
puts ""
}
}</langsyntaxhighlight>
 
=={{header|TXR}}==
Line 1,625 ⟶ 2,946:
A little sprinkling of regex is used.
 
<langsyntaxhighlight lang="txr">#!/usr/bin/txr -f
@(next :args)
@(cases)
Line 1,647 ⟶ 2,968:
@ (end)
@(end)
</syntaxhighlight>
</lang>
 
Sample run:
Line 1,695 ⟶ 3,016:
</pre>
 
=={{header|Wren}}==
{{libheader|libcurl}}
{{libheader|Wren-pattern}}
An embedded program so we can use libcurl.
 
A somewhat ''ad hoc'' solution as the output format for Yahoo! search seems to change quite frequently. All I can say is that this worked on 5th January, 2022.
<syntaxhighlight lang="wren">/* Yahoo_search_interface.wren */
 
import "./pattern" for Pattern
 
class YahooSearch {
construct new(url, title, desc) {
_url = url
_title = title
_desc = desc
}
 
toString { "URL: %(_url)\nTitle: %(_title)\nDescription: %(_desc)\n" }
}
 
var CURLOPT_URL = 10002
var CURLOPT_FOLLOWLOCATION = 52
var CURLOPT_WRITEFUNCTION = 20011
var CURLOPT_WRITEDATA = 10001
 
foreign class Buffer {
construct new() {} // C will allocate buffer of a suitable size
 
foreign value // returns buffer contents as a string
}
 
foreign class Curl {
construct easyInit() {}
 
foreign easySetOpt(opt, param)
 
foreign easyPerform()
 
foreign easyCleanup()
}
 
var curl = Curl.easyInit()
 
var getContent = Fn.new { |url|
var buffer = Buffer.new()
curl.easySetOpt(CURLOPT_URL, url)
curl.easySetOpt(CURLOPT_FOLLOWLOCATION, 1)
curl.easySetOpt(CURLOPT_WRITEFUNCTION, 0) // write function to be supplied by C
curl.easySetOpt(CURLOPT_WRITEDATA, buffer)
curl.easyPerform()
return buffer.value
}
 
var p1 = Pattern.new("class/=\" d-ib ls-05 fz-20 lh-26 td-hu tc va-bot mxw-100p\" href/=\"[+1^\"]\"")
var p2 = Pattern.new("class/=\" d-ib p-abs t-0 l-0 fz-14 lh-20 fc-obsidian wr-bw ls-n pb-4\">[+1^<]<")
var p3 = Pattern.new("<span class/=\" fc-falcon\">[+1^<]<")
 
var pageSize = 7
var totalCount = 0
 
var yahooSearch = Fn.new { |query, page|
System.print("Page %(page):\n=======\n")
var next = (page - 1) * pageSize + 1
var url = "https://search.yahoo.com/search?fr=opensearch&pz=%(pageSize)&p=%(query)&b=%(next)"
var content = getContent.call(url).replace("<b>", "").replace("</b>", "")
var matches1 = p1.findAll(content)
var count = matches1.count
if (count == 0) return false
var matches2 = p2.findAll(content)
var matches3 = p3.findAll(content)
totalCount = totalCount + count
var ys = List.filled(count, null)
for (i in 0...count) {
var url = matches1[i].capsText[0]
var title = matches2[i].capsText[0]
var desc = matches3[i].capsText[0].replace("&#39;", "'")
ys[i] = YahooSearch.new(url, title, desc)
}
System.print(ys.join("\n"))
return true
}
 
var page = 1
var limit = 2
var query = "rosettacode"
System.print("Searching for '%(query)' on Yahoo!\n")
while (page <= limit && yahooSearch.call(query, page)) {
page = page + 1
System.print()
}
System.print("Displayed %(limit) pages with a total of %(totalCount) entries.")
curl.easyCleanup()</syntaxhighlight>
<br>
We now embed this script in the following C program, build and run.
<syntaxhighlight lang="c">/* gcc Yahoo_search_interface.c -o Yahoo_search_interface -lcurl -lwren -lm */
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>
#include "wren.h"
 
struct MemoryStruct {
char *memory;
size_t size;
};
 
/* C <=> Wren interface functions */
 
static size_t WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp) {
size_t realsize = size * nmemb;
struct MemoryStruct *mem = (struct MemoryStruct *)userp;
char *ptr = realloc(mem->memory, mem->size + realsize + 1);
if(!ptr) {
/* out of memory! */
printf("not enough memory (realloc returned NULL)\n");
return 0;
}
 
mem->memory = ptr;
memcpy(&(mem->memory[mem->size]), contents, realsize);
mem->size += realsize;
mem->memory[mem->size] = 0;
return realsize;
}
 
void C_bufferAllocate(WrenVM* vm) {
struct MemoryStruct *ms = (struct MemoryStruct *)wrenSetSlotNewForeign(vm, 0, 0, sizeof(struct MemoryStruct));
ms->memory = malloc(1);
ms->size = 0;
}
 
void C_bufferFinalize(void* data) {
struct MemoryStruct *ms = (struct MemoryStruct *)data;
free(ms->memory);
}
 
void C_curlAllocate(WrenVM* vm) {
CURL** pcurl = (CURL**)wrenSetSlotNewForeign(vm, 0, 0, sizeof(CURL*));
*pcurl = curl_easy_init();
}
 
void C_value(WrenVM* vm) {
struct MemoryStruct *ms = (struct MemoryStruct *)wrenGetSlotForeign(vm, 0);
wrenSetSlotString(vm, 0, ms->memory);
}
 
void C_easyPerform(WrenVM* vm) {
CURL* curl = *(CURL**)wrenGetSlotForeign(vm, 0);
curl_easy_perform(curl);
}
 
void C_easyCleanup(WrenVM* vm) {
CURL* curl = *(CURL**)wrenGetSlotForeign(vm, 0);
curl_easy_cleanup(curl);
}
 
void C_easySetOpt(WrenVM* vm) {
CURL* curl = *(CURL**)wrenGetSlotForeign(vm, 0);
CURLoption opt = (CURLoption)wrenGetSlotDouble(vm, 1);
if (opt < 10000) {
long lparam = (long)wrenGetSlotDouble(vm, 2);
curl_easy_setopt(curl, opt, lparam);
} else if (opt < 20000) {
if (opt == CURLOPT_WRITEDATA) {
struct MemoryStruct *ms = (struct MemoryStruct *)wrenGetSlotForeign(vm, 2);
curl_easy_setopt(curl, opt, (void *)ms);
} else if (opt == CURLOPT_URL) {
const char *url = wrenGetSlotString(vm, 2);
curl_easy_setopt(curl, opt, url);
}
} else if (opt < 30000) {
if (opt == CURLOPT_WRITEFUNCTION) {
curl_easy_setopt(curl, opt, &WriteMemoryCallback);
}
}
}
 
WrenForeignClassMethods bindForeignClass(WrenVM* vm, const char* module, const char* className) {
WrenForeignClassMethods methods;
methods.allocate = NULL;
methods.finalize = NULL;
if (strcmp(module, "main") == 0) {
if (strcmp(className, "Buffer") == 0) {
methods.allocate = C_bufferAllocate;
methods.finalize = C_bufferFinalize;
} else if (strcmp(className, "Curl") == 0) {
methods.allocate = C_curlAllocate;
}
}
return methods;
}
 
WrenForeignMethodFn bindForeignMethod(
WrenVM* vm,
const char* module,
const char* className,
bool isStatic,
const char* signature) {
if (strcmp(module, "main") == 0) {
if (strcmp(className, "Buffer") == 0) {
if (!isStatic && strcmp(signature, "value") == 0) return C_value;
} else if (strcmp(className, "Curl") == 0) {
if (!isStatic && strcmp(signature, "easySetOpt(_,_)") == 0) return C_easySetOpt;
if (!isStatic && strcmp(signature, "easyPerform()") == 0) return C_easyPerform;
if (!isStatic && strcmp(signature, "easyCleanup()") == 0) return C_easyCleanup;
}
}
return NULL;
}
 
static void writeFn(WrenVM* vm, const char* text) {
printf("%s", text);
}
 
void errorFn(WrenVM* vm, WrenErrorType errorType, const char* module, const int line, const char* msg) {
switch (errorType) {
case WREN_ERROR_COMPILE:
printf("[%s line %d] [Error] %s\n", module, line, msg);
break;
case WREN_ERROR_STACK_TRACE:
printf("[%s line %d] in %s\n", module, line, msg);
break;
case WREN_ERROR_RUNTIME:
printf("[Runtime Error] %s\n", msg);
break;
}
}
 
char *readFile(const char *fileName) {
FILE *f = fopen(fileName, "r");
fseek(f, 0, SEEK_END);
long fsize = ftell(f);
rewind(f);
char *script = malloc(fsize + 1);
fread(script, 1, fsize, f);
fclose(f);
script[fsize] = 0;
return script;
}
 
static void loadModuleComplete(WrenVM* vm, const char* module, WrenLoadModuleResult result) {
if( result.source) free((void*)result.source);
}
 
WrenLoadModuleResult loadModule(WrenVM* vm, const char* name) {
WrenLoadModuleResult result = {0};
if (strcmp(name, "random") != 0 && strcmp(name, "meta") != 0) {
result.onComplete = loadModuleComplete;
char fullName[strlen(name) + 6];
strcpy(fullName, name);
strcat(fullName, ".wren");
result.source = readFile(fullName);
}
return result;
}
 
int main(int argc, char **argv) {
WrenConfiguration config;
wrenInitConfiguration(&config);
config.writeFn = &writeFn;
config.errorFn = &errorFn;
config.bindForeignClassFn = &bindForeignClass;
config.bindForeignMethodFn = &bindForeignMethod;
config.loadModuleFn = &loadModule;
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "Yahoo_search_interface.wren";
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
switch (result) {
case WREN_RESULT_COMPILE_ERROR:
printf("Compile Error!\n");
break;
case WREN_RESULT_RUNTIME_ERROR:
printf("Runtime Error!\n");
break;
case WREN_RESULT_SUCCESS:
break;
}
wrenFreeVM(vm);
free(script);
return 0;
}</syntaxhighlight>
 
{{out}}
Limited to first two pages.
<pre>
Searching for 'rosettacode' on Yahoo!
 
Page 1:
=======
 
URL: https://rosettacode.org/wiki/Rosetta_Code
Title: rosettacode.org
Description: Enjoy amazing savings with our 50% off
 
URL: https://en.wikipedia.org/wiki/Rosetta_Code
Title: en.wikipedia.org
Description: 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://raku.org/community/rosettacode/
Title: raku.org
Description: 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://metacpan.org/dist/RosettaCode/view/bin/rosettacode
Title: metacpan.org
Description: 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://simple.wikipedia.org/wiki/Rosetta_Code
Title: simple.wikipedia.org
Description: To install RosettaCode, copy and paste the appropriate command in to your terminal. cpanm. cpanm RosettaCode. CPAN shell. perl -MCPAN -e shell install RosettaCode
 
 
Page 2:
=======
 
URL: https://improbotics.org/rosetta-code/
Title: improbotics.org
Description: Enjoy amazing savings with our 50% off
 
URL: https://en.wikipedia.org/wiki/Rosetta_Code
Title: en.wikipedia.org
Description: 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://www.freecodecamp.org/news/rosetta-code-unlocking-the-mysteries-of-the-programming-languages-that-power-our-world-300b787d8401/
Title: www.freecodecamp.org
Description: 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://raku.org/community/rosettacode/
Title: raku.org
Description: Rosetta Code — unlocking the mysteries of the programming languages that power our world. Peter Gleeson. The original Rosetta Stone, via History.com. It’s no secret that the tech world is dominated by a relatively small pool of programming languages. While exact figures are difficult to obtain (and no doubt vary over time), you could ...
 
URL: https://rosettacode.org/wiki/SHA-256
Title: rosettacode.org
Description: 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://twitter.com/rosettacode
Title: twitter.com
Description: SHA-256 is the recommended stronger alternative to SHA-1.See FIPS PUB 180-4 for implementation details.. Either by using a dedicated library or implementing the ...
 
URL: https://deals.usnews.com/coupons/rosetta-stone
Title: deals.usnews.com
Description: We would like to show you a description here but the site won’t allow us.
 
 
Displayed 2 pages with a total of 12 entries.
</pre>
 
{{omit from|Batch File|Does not have network access.}}
{{omit from|Brlcad}}
{{omit from|EasyLang|Does not have network access.}}
{{omit from|Lilypond}}
{{omit from|Locomotive Basic|Does not have network access.}}
9,476

edits