Yahoo! search interface: Difference between revisions
Content added Content deleted
(→{{header|Tcl}}: add example using OO and an html parser) |
|||
Line 207: | Line 207: | ||
=={{header|Tcl}}== |
=={{header|Tcl}}== |
||
{{trans|Python}} |
{{trans|Python}} |
||
{{incorrect|Tcl|This example is not implementing a Next Page method.}} |
|||
<lang tcl>package require http |
<lang tcl>package require http |
||
Line 236: | Line 235: | ||
} |
} |
||
proc Nextpage {term} { |
|||
# Usage: |
|||
incr ::page |
|||
⚫ | |||
return [YahooSearch $term $::page] |
|||
⚫ | |||
} |
|||
# Usage: get the first two pages of results |
|||
set page 1 |
|||
set term "test" |
|||
foreach result_set [list [YahooSearch $term] [Nextpage $term]] { |
|||
⚫ | |||
⚫ | |||
} |
|||
}</lang> |
}</lang> |
||
Tcl 8.6 can use its coroutine support to produce an iterator more like that Python code: |
Tcl 8.6 can use its coroutine support to produce an iterator more like that Python code: |