Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- ## IMPORTANT: This code will cease functioning in July 2011 when Yahoo BOSS discontinues the first version of their API and moves everyone to a new paid version
- ## You would be much better off using Bing API search that I made after this: http://pastebin.com/D6ABsdsa
- ## !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- ####### Basic Yahoo BOSS (http://developer.yahoo.com/search/boss) search in dotCMS
- ####### Modified May 4, 2011 to get rid of a bunch of unnecessary .get() statements
- ## Your Yahoo Application ID (Info here: http://developer.yahoo.com/faq/)
- #set($appId="YOURAPPID")
- ## Gets your search term from the query string on your site (e.g. www.mysite.com/search.dot?q=odie)
- #set($mySearch=$request.getParameter("q"))
- ## Determine which sites you would like to search
- #set($sites="www.garfield.com,www.gocomics.com")
- ## Puts it all together
- #set($jsonPath = "http://boss.yahooapis.com/ysearch/web/v1/$!{mySearch}?appid=$!{appId}--&format=json&sites=$!{sites}")
- #set($myjson = $json.fetch("$jsonPath"))
- #set($resultset=$myjson.ysearchresponse.resultset_web)
- <h1>Searching for term "$mySearch"</h1>
- <ul>
- #foreach($result in $resultset)
- <li>
- <h2>$result.title</h2>
- <p>$result.abstract</p>
- <a href="$result.clickurl">$result.dispurl</a>
- </li>
- #end
- </ul>
Add Comment
Please, Sign In to add comment