yahoo hacks only 4 lovish's readers
This document was created by Lovish
Contents
Yahoo! Hacks
Table of Contents
Copyright
Credits
About the Author
Contributors
Acknowledgments
Preface
Why Yahoo! Hacks?
How to Use This Book
How to Run the Hacks
How This Book Is Organized
Conventions Used in This Book
Using Code Examples
Safari Enabled
How to Contact Us
Got a Hack?
Chapter 1. Search
Section 1.1. Hacks 122: Introduction
Hack 1. Fine-Tune Yahoo! Web Search Queries
Hack 2. Save Time with Search Shortcuts
Hack 3. Create a Yahoo! ID
Hack 4. Set Persistent Yahoo! Search Preferences
Hack 5. Assemble Advanced Search Queries
Hack 6. Translate Any Page with Yahoo!
Hack 7. Personalize, Track, and Share the Web
Hack 8. Prefetch Yahoo! Search Results
Hack 9. Compare Yahoo! and Google Search Results
Hack 10. Find Content You Can Reuse Legally
Hack 11. Find Video from Across the Web
Hack 12. Streamline Browsing with the Yahoo! Toolbar
Hack 13. Customize the Firefox Quick Search Box
Hack 14. Spot Trends with Yahoo! Buzz
Hack 15. Find Hot Technologies at the Buzz Game
Hack 16. Tame Long Yahoo! URLs
Hack 17. Opt Out of Advertiser Cookies
Hack 18. Track News About Yahoo!
Hack 19. Spider the Yahoo! Catalog
Hack 20. Browse the Yahoo! Directory
Hack 21. Track Additions to Yahoo!
Hack 22. Yahoo! Directory Mindshare in Google
Chapter 2. Services
Section 2.1. Hacks 2350: Introduction
Hack 23. Track Your Investments
Hack 24. Build Your Own Stock Update Email
Hack 25. Download Financial Data Using Excel Web Queries
Hack 26. Convert Currencies with One Click
Hack 27. Do the Math with Yahoo! Calculators
Hack 28. Add a Yahoo! Bookmark with One Click
Hack 29. Import Existing Bookmarks into Yahoo! Bookmarks
Hack 30. Open Yahoo! Bookmarks in a Sidebar
Hack 31. Publish Your Yahoo! Bookmarks
Hack 32. Track the Media's Attention Span over Time
Hack 33. Monitor the News with RSS
Hack 34. Personalize My Yahoo!
Hack 35. Track Your Favorite Sites with RSS
Hack 36. Add a Feed to My Yahoo! with a Right-Click
Hack 37. Build Your Own News Crawler
Hack 38. Replace Your Phone Book with Yahoo!
Hack 39. Monitor Your Commute
Hack 40. Get the Facts at Yahoo! Reference
Hack 41. Find and Rate Movies
Hack 42. Subscribe to Movie Showtimes
Hack 43. View Movie Lists on Your Cell Phone
Hack 44. Plan Your TV Viewing
Hack 45. Create a TV Watch List
Hack 46. Develop and Share a Trip Itinerary
Hack 47. Shop Intelligently
Hack 48. Visualize Your Music Collection
Hack 49. Take Yahoo! on the Go
Hack 50. Stay Connected with Yahoo! Alerts
Chapter 3. Communicating
Section 3.1. Hacks 5167: Introduction
Hack 51. Navigate Yahoo! Mail
Hack 52. Manage Yahoo! Mail
Hack 53. Create Yahoo! Mail Macros
Hack 54. Read All Your Email in One Place
Hack 55. Read Yahoo! Mail in Your Preferred Email Client
Hack 56. Manage and Share Your Schedule
Hack 57. Add Contacts to Your Yahoo! Address Book
Hack 58. Map Yahoo! Address Book Contacts
Hack 59. Discuss, Share, and Collaborate with Others
Hack 60. Archive Yahoo! Groups Messages with yahoo2mbox
Hack 61. Explore Your Social Networks
Hack 62. Import an Existing Blogroll to Yahoo! 360
Hack 63. Add an API to Your Yahoo! 360 Blog
Hack 64. Create a Yahoo! Avatar
Hack 65. Add a Content Tab to Yahoo! Messenger
Hack 66. Send Instant Messages Beyond Yahoo!
Hack 67. Store, Sort, and Share Your Photos
Chapter 4. Web Services
Section 4.1. Hacks 6876: Introduction
Section 4.2.
Hack 68. Program Yahoo! with Perl
Hack 69. Program Yahoo! with PHP 5
Hack 70. Program Yahoo! with Python
Hack 71. Program Yahoo! with VBScript
Hack 72. Program Yahoo! with ColdFusion
Hack 73. Program Yahoo! with XSLT
Hack 74. Program Yahoo! with Java
Hack 75. Program Yahoo! with Ruby
Hack 76. Program Yahoo! with REBOL
Chapter 5. Applications
Section 5.1. Hacks 7791: Introduction
Hack 77. Visualize Yahoo! Web Search Results
Hack 78. Find Links to Any Web Site
Hack 79. Import Yahoo! Local Listings into Your Address Book
Hack 80. Create a Yahoo! Local MIDlet
Hack 81. Import Yahoo! Local Listings into Excel
Hack 82. Spell Words with Yahoo! Images
Hack 83. Randomize Your Windows Desktop Background
Hack 84. Randomize Your Mac Desktop Background
Hack 85. Mash Up Images from Around the Web
Hack 86. Illustrate Any Web Site
Hack 87. Add Links to a Block of Text Automatically
Hack 88. Visualize News Topics as Tags
Hack 89. Get Related Terms Instantly with Ajax
Hack 90. Compare the Popularity of Related Search Terms
Hack 91. Plot Multiple Points on Your Own Map
Chapter 6. Webmastering
Section 6.1. Hacks 92100: Introduction
Hack 92. Get Your Site Listed at Yahoo!
Hack 93. Hide Part of Your Web Site from Yahoo!
Hack 94. Search Your Web Site with Yahoo!
Hack 95. Add Presence to Your Web Site
Hack 96. Syndicate Rich Media
Hack 97. Add Contextual Search to Your Blog
Hack 98. Post Photos to Your Blog
Hack 99. Feed Your Latest Photos to Your Web Site
Hack 100. Display Messages from a Yahoo! Group on Your Web Site
Colophon
Index
SYMBOL
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Yahoo! Hacks
By Paul Bausch
...............................................
Publisher: O'Reilly
Pub Date: October 2005
ISBN: 0-596-00945-3
Pages: 489
Table of Contents | Index
Yahoo! took the world by storm in the 1990s as a one-of-a-kind, searchable
list of interesting web sites. But ten years later, it has expanded into a
department store overflowing with useful and innovative tools and
services-from email, blogging, social networking, and instant messaging,
to news, financial markets, shopping, movie and TV listings, and much
more. Today's Yahoo! keeps you connected with every aspect of your life
and every corner of the Web.
Yahoo! Hacks shows you how to use, expand, personalize, and tweak Yahoo!
in ways you never dreamed possible. You'll learn how to:
Fine-tune search queries with keyword shortcuts and advanced syntax
Manage and customize Yahoo! Mail, using it as your universal email
client to access all your other accounts
Explore your social networks with Yahoo! 360, blogging your life,
keeping up with friends, and making new contacts
Store, sort, blog, feed, track, and otherwise share photos with Flickr
and RSS
Make My Yahoo! your Yahoo!, and personalize Yahoo!'s many properties
Roll your own Yahoo! applications with Yahoo! new Web Services API and
Perl, PHP, Java, Python, Ruby, or the programming language of your
choice
Visualize search results and topics, mash up images from around the Web,
and remix other web content
List (or hide) your site with Yahoo!, and integrate Yahoo! Groups,
Messenger, contextual search (Y!Q), or other Yahoo! features
Whether you want to become a power searcher, news monger, super shopper,
or innovative web developer, Yahoo! Hacks provides the tools to take you
further than you ever thought possible.
Yahoo! Hacks
By Paul Bausch
...............................................
Publisher: O'Reilly
Pub Date: October 2005
ISBN: 0-596-00945-3
Pages: 489
Table of Contents | Index
Copyright
Credits
About the Author
Contributors
Acknowledgments
Preface
Why Yahoo! Hacks?
How to Use This Book
How to Run the Hacks
How This Book Is Organized
Conventions Used in This Book
Using Code Examples
Safari Enabled
How to Contact Us
Got a Hack?
Chapter 1. Search
Section 1.1. Hacks 122: Introduction
Hack 1. Fine-Tune Yahoo! Web Search Queries
Hack 2. Save Time with Search Shortcuts
Hack 3. Create a Yahoo! ID
Hack 4. Set Persistent Yahoo! Search Preferences
Hack 5. Assemble Advanced Search Queries
Hack 6. Translate Any Page with Yahoo!
Hack 7. Personalize, Track, and Share the Web
Hack 8. Prefetch Yahoo! Search Results
Hack 9. Compare Yahoo! and Google Search Results
Hack 10. Find Content You Can Reuse Legally
Hack 11. Find Video from Across the Web
Hack 12. Streamline Browsing with the Yahoo! Toolbar
Hack 13. Customize the Firefox Quick Search Box
Hack 14. Spot Trends with Yahoo! Buzz
Hack 15. Find Hot Technologies at the Buzz Game
Hack 16. Tame Long Yahoo! URLs
Hack 17. Opt Out of Advertiser Cookies
Hack 18. Track News About Yahoo!
Hack 19. Spider the Yahoo! Catalog
Hack 20. Browse the Yahoo! Directory
Hack 21. Track Additions to Yahoo!
Hack 22. Yahoo! Directory Mindshare in Google
Chapter 2. Services
Section 2.1. Hacks 2350: Introduction
Hack 23. Track Your Investments
Hack 24. Build Your Own Stock Update Email
Hack 25. Download Financial Data Using Excel Web Queries
Hack 26. Convert Currencies with One Click
Hack 27. Do the Math with Yahoo! Calculators
Hack 28. Add a Yahoo! Bookmark with One Click
Hack 29. Import Existing Bookmarks into Yahoo! Bookmarks
Hack 30. Open Yahoo! Bookmarks in a Sidebar
Hack 31. Publish Your Yahoo! Bookmarks
Hack 32. Track the Media's Attention Span over Time
Hack 33. Monitor the News with RSS
Hack 34. Personalize My Yahoo!
Hack 35. Track Your Favorite Sites with RSS
Hack 36. Add a Feed to My Yahoo! with a Right-Click
Hack 37. Build Your Own News Crawler
Hack 38. Replace Your Phone Book with Yahoo!
Hack 39. Monitor Your Commute
Hack 40. Get the Facts at Yahoo! Reference
Hack 41. Find and Rate Movies
Hack 42. Subscribe to Movie Showtimes
Hack 43. View Movie Lists on Your Cell Phone
Hack 44. Plan Your TV Viewing
Hack 45. Create a TV Watch List
Hack 46. Develop and Share a Trip Itinerary
Hack 47. Shop Intelligently
Hack 48. Visualize Your Music Collection
Hack 49. Take Yahoo! on the Go
Hack 50. Stay Connected with Yahoo! Alerts
Chapter 3. Communicating
Section 3.1. Hacks 5167: Introduction
Hack 51. Navigate Yahoo! Mail
Hack 52. Manage Yahoo! Mail
Hack 53. Create Yahoo! Mail Macros
Hack 54. Read All Your Email in One Place
Hack 55. Read Yahoo! Mail in Your Preferred Email Client
Hack 56. Manage and Share Your Schedule
Hack 57. Add Contacts to Your Yahoo! Address Book
Hack 58. Map Yahoo! Address Book Contacts
Hack 59. Discuss, Share, and Collaborate with Others
Hack 60. Archive Yahoo! Groups Messages with yahoo2mbox
Hack 61. Explore Your Social Networks
Hack 62. Import an Existing Blogroll to Yahoo! 360
Hack 63. Add an API to Your Yahoo! 360 Blog
Hack 64. Create a Yahoo! Avatar
Hack 65. Add a Content Tab to Yahoo! Messenger
Hack 66. Send Instant Messages Beyond Yahoo!
Hack 67. Store, Sort, and Share Your Photos
Chapter 4. Web Services
Section 4.1. Hacks 6876: Introduction
Section 4.2.
Hack 68. Program Yahoo! with Perl
Hack 69. Program Yahoo! with PHP 5
Hack 70. Program Yahoo! with Python
Hack 71. Program Yahoo! with VBScript
Hack 72. Program Yahoo! with ColdFusion
Hack 73. Program Yahoo! with XSLT
Hack 74. Program Yahoo! with Java
Hack 75. Program Yahoo! with Ruby
Hack 76. Program Yahoo! with REBOL
Chapter 5. Applications
Section 5.1. Hacks 7791: Introduction
Hack 77. Visualize Yahoo! Web Search Results
Hack 78. Find Links to Any Web Site
Hack 79. Import Yahoo! Local Listings into Your Address Book
Hack 80. Create a Yahoo! Local MIDlet
Hack 81. Import Yahoo! Local Listings into Excel
Hack 82. Spell Words with Yahoo! Images
Hack 83. Randomize Your Windows Desktop Background
Hack 84. Randomize Your Mac Desktop Background
Hack 85. Mash Up Images from Around the Web
Hack 86. Illustrate Any Web Site
Hack 87. Add Links to a Block of Text Automatically
Hack 88. Visualize News Topics as Tags
Hack 89. Get Related Terms Instantly with Ajax
Hack 90. Compare the Popularity of Related Search Terms
Hack 91. Plot Multiple Points on Your Own Map
Chapter 6. Webmastering
Section 6.1. Hacks 92100: Introduction
Hack 92. Get Your Site Listed at Yahoo!
Hack 93. Hide Part of Your Web Site from Yahoo!
Hack 94. Search Your Web Site with Yahoo!
Hack 95. Add Presence to Your Web Site
Hack 96. Syndicate Rich Media
Hack 97. Add Contextual Search to Your Blog
Hack 98. Post Photos to Your Blog
Hack 99. Feed Your Latest Photos to Your Web Site
Hack 100. Display Messages from a Yahoo! Group on Your Web Site
Colophon
Index
Copyright © 2006 O'Reilly Media, Inc. All rights reserved.
Printed in the United States of America.
Published by O'Reilly Media, Inc., 1005 Gravenstein Highway North,
Sebastopol, CA 95472.
O'Reilly books may be purchased for educational, business, or sales
promotional use. Online editions are also available for most titles
(safari.oreilly.com). For more information, contact our
corporate/institutional sales department: (800) 998-9938 or
corporate@oreilly.com.
Table
Editor:
Brian Sawyer
Production Editor:
A. J. Fox
Series Editor:
Rael Dornfest
Cover Designer:
Hanna Dyer
Executive Editor:
Dale Dougherty
Interior Designer:
David Futato
Printing History:
October 2005:
First Edition.
Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are
registered trademarks of O'Reilly Media, Inc. The Hacks series
designations, Yahoo! Hacks, the image of boots and spurs, and related
trade dress are trademarks of O'Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish
their products are claimed as trademarks. Where those designations appear
in this book, and O'Reilly Media, Inc., was aware of a trademark claim,
the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the
publisher and author assume no responsibility for errors or omissions, or
for damages resulting from the use of the information contained herein.
Small print: The technologies discussed in this publication, the
limitations on these technologies that technology and content owners seek
to impose, and the laws actually limiting the use of these technologies
are constantly changing. Thus, some of the hacks described in this
publication may not work, may cause unintended harm to systems on which
they are used, or may not be consistent with applicable user agreements.
Your use of these hacks is at your own risk, and O'Reilly Media, Inc.
disclaims responsibility for any damage or expense resulting from their
use. In any event, you should take care that your use of these hacks does
not violate any applicable laws, including copyright laws.
This book uses RepKover™, a durable and flexible lay-flat binding.
ISBN: 0-596-00945-3
[C]
Credits
About the Author
Contributors
Acknowledgments
About the Author
Paul Bausch is an independent web developer living in Corvallis, Oregon.
When he's not hacking together web applications, he's writing about
hacking together web applications. He put together Amazon Hacks for
O'Reilly in 2003. Paul also helped create the popular weblog application
Blogger (http://www.blogger.com/), cowrote a book about weblogs called We
Blog: Publishing Online with Weblogs (Wiley), and maintains a directory of
Oregon weblogs called ORblogs (http://www.orblogs.com/). When he's not
working on a book, Paul posts thoughts and photos to his personal weblog,
onfocus (http://www.onfocus.com/).
Contributors
The following people contributed their hacks, writing, and inspiration to
this book:
Jacek Artymiak (http://www.artymiak.com/) is a freelance consultant,
developer, and writer. He's been programming computers since 1986,
starting with the Sinclair ZX Spectrum. His interests include network
security, computer graphics and animation, and multimedia. Jacek lives
in Lublin, Poland, with his wife, Gosia, and can be reached at
jacek@artymiak.com.
Bonnie Biafore is the author of several books about personal finance,
investing, and project management. As an engineer, she's tenaciously
attentive to detail and digests tantalizing morsels about every topic
she approaches. Her sick sense of humor turns subjects that are
droolinducing in other books into entertaining, easy reading. Her book
the NAIC Stock Selection Handbook won major awards from both the Society
of Technical Communication and APEX Awards for Publication Excellence,
but she cherishes the raves she's received from beginning investors most
of all. She is also the author of Online Investing Hacks (O'Reilly) and
QuickBooks 2005: The Missing Manual (O'Reilly). Bonnie writes a monthly
column called WebWatch for Better Investing magazine and is a regular
contributor to WomensWallStreet.com. As a consultant, she manages
projects for clients and wins accolades for her ability to herd cats.
When not chained to her computer, she hikes in the mountains with her
dogs, cooks gourmet meals, and practices saying no to additional work
assignments. You can learn more at Bonnie's web site,
http://www.bonniebiafore.com/, or email her at bonnie.biafore@gmail.com.
Tara Calishain is the editor of ResearchBuzz
(http://www.researchbuzz.com/), a weekly newsletter on Internet
searching and online information resources. She's also a regular
columnist for Searcher magazine. She's been writing about search engines
and searching since 1996; her recent books include Google Hacks
(O'Reilly) and Web Search Garage (O'Reilly).
Kevin Hemenway (http://www.disobey.com/), better known as Morbus Iff, is
the creator of Disobey.com, which bills itself as "content for the
discontented." Publisher, developer, and writer of more home cooking
than you could ever imagine (like the popular open sourced syndicated
reader AmphetaDesk, the best-kept gaming secret Gamegrene.com, the
popular Ghost Sites and Nonsense Network, the giggle-inducing articles
at the O'Reilly Network, a few pieces at Apple's Internet Developer
site, etc.), he's an ardent supporter of cloning, merely so he can get
more work done. He cooks with a Fry Pan of Intellect +2 and lives in
Concord, New Hampshire.
Ryan Kennedy is a software engineer at Yahoo!, working on Yahoo! Mail.
In his spare time, he maintains the Yahoo! Java Search SDK.
Philipp Lenssen lives in Stuttgart, Germany, where he blogs about
Google, works as a programmer on an automobile web site, and eats spicy
Thai food with his girlfriend. He likes to ponder future technology and
jump on any technology bandwagon that seems worthwhile, especially all
the APIs that make a developer's life that much easier. Philipp's daily
musings can be found at http://blog.outer-court.com/.
Mikel Maron is an independent software developer and ecologist. He has
built several geographic-oriented projects around the worldKit mapping
package, including World as a Blog and mapufacture. Previously, he led
development of My Yahoo! in the pre-RSS days. Mikel was awarded a
master's degree from the University of Sussex for building a simulation
of the evolution of complexity in food webs. Originally from California,
Mikel is presently based mostly in Brighton, United Kingdom, with his
wife, Anna. Links to various things can be found at
http://brainoff.com/.
Deepak Nadig is an entrepreneur and has helped build innovative and
useful products for 14 years. He is currently taking a break after
cofounding and selling Covigna, a pioneer in Contract Lifecycle
Management.
Todd Ogasawara focuses on Mobile Workforce and Mobile Lifestyle
technology, paying special attention to the Microsoft Windows Mobile
platform (Pocket PC and Smartphone). Microsoft has recognized his
demonstrated practical expertise and willingness to share his experience
by recognizing him as a Microsoft Most Valuable Professional (MVP) in
the Mobile Devices category since 2000. His other technology focus is in
the effort to bring commercial (especially Microsoft-related) products
and GNU/Open Source software together in a synergistic and productive
way. Todd has written several articles about mobile devices, digital
cameras, and the Apple Mac Mini for the O'Reilly Network. He previously
worked as a technology analyst for GTE/Verizon. He also served as the
contracted forum manager for the MSN.com (and later ZDNet) Telephony
Forum and Windows CE Forum. More recently, he has served as the
eGovernment team leader for the State of Hawaii. You can find his Mobile
Workforce and Lifestyle commentary at http://www.mobileviews.com/. You
can learn more about Eccentric Technology at
http://www.ogasawalrus.com/. You can reach Todd by email at
Hacks@OgasaWalrus.com.
Mark Pilgrim is an accessibility architect by day. By night, he is a
husband and father who lives in North Carolina with his wife, his son,
and his dog. Mark spends his copious free time sunbathing, skydiving,
and reading Immanuel Kant's Critique of Pure Reason in the original
Klingon. He can be found stirring up trouble at
http://diveintomark.org/.
Premshree Pillai is a geek working at Yahoo!. He loves Ruby, beer, and
classic rock. He blogs at http://www.livejournal.com/users/premshree.
Eric Ries is currently CTO of IMVU, a startup creating 3-D, avatarbased
instant messaging. Eric also serves, in a volunteer capacity, as CTO of
the Taproot Foundation. Previously, he was senior software engineer at
There and cofounder and CTO of Catalyst Recruiting. He is author of
several free software projects, most recently the peer-to-peer RPC
system Kenosis, and coauthor of several books, including The Black Art
of Java Game Programming and Mastering Java.
Alan Taylor has been a web developer for over 10 years and has worked
for Monster.com, MSNBC.com, and Amazon.com. He builds web projects (such
as Amazon Light; http://kokogiak.com/amazon) and web hacks/toys on an
irregular basis, most of which can be found at http://kokogiak.com/.
Alan believes that open APIs are your friends and are positively the
best trend on the Internet in years.
Acknowledgments
To my wife, Shawnde, thanks for the continuous feedback and frontline
editing, and for cheerfully discussing Yahoo! during breakfast, lunch,
dinner, and every spare moment in between.
Many thanks go to Brian Sawyer for providing direction and encouragement,
and for fine-tuning the text.
Thanks to tech editor Steve Champeon for testing code, double-checking
facts, and adding important points to the technical details.
Thanks to Morbus Iff for taking my Perl to task and simplifying the
confusing bits.
Finally, thanks to everyone at Yahoo! who contributed tips and hack ideas,
including Vijay Anisetti, Stig Sæther Bakken, Dave Brown, Aurora Casanova,
David Dueblin, Jennifer Dulski, Marcus Foster, David Hall, Jason B.
Silverstein, Jeremy Zawodny, and many anonymous Yahoos. Thanks also to
Chris Kalaboukis and Bernard Mangold at Yahoo! Research for lending a
hand.
Preface
Yahoo! is an impressive example of what can happen when a hobby takes on a
life of its own. In 1994, Jerry Yang and David Filo began publishing a
personal list of sites they found interesting on the emerging World Wide
Web. As "Jerry's Guide to the World Wide Web" grew larger, the two
Stanford grad students began organizing the sites into categories, and the
basic structure of today's Yahoo! Directory was born. By late 1994, they
chose to rename their directory after the word yahoo because its original
definition describing a crude, rude person appealed to the pair's
subversive natures. (And as true computer geeks, they turned Yahoo! into
an acronym for Yet Another Hierarchical Officious Oracle.) Figure P-1 is a
look at the Yahoo! home page from December 1994.
Yahoo! looks very different today. Figure P-2 shows the more familiar
Yahoo! home page of 2005.
Though the two Yahoo! home pages look radically different, the original
idea of taming the chaos of the World Wide Web and making it accessible to
a wider audience remains. According to their vision statement, Yahoo!
wants "to enable people to find, use, share, and expand all human
knowledge." The goal of furthering this vision, nicknamed FUSE (for "find,
use, share, and expand"), can be found in every acquisition Yahoo! makes
and every product Yahoo! releases. Yahoo! has localized versions of its
offerings in dozens of countries, and the Yahoo! brand is recognized
around the world. Over the past 10 years, Yahoo! has become much more than
a guide to the Web; Yahoo! is a platform for visualizing and connecting
with the world.
Many Yahoo! features are familiar to anyone who uses the Web. Millions of
people use Yahoo! Search to find information on the Web. Millions more use
Yahoo! Groups to share information and collaborate on projects. And still
more use Yahoo! Mail every day to stay in touch with friends, family, and
coworkers. And Yahoo! is continually adding products and features to
realize its vision.
Figure I-1. Yahoo! in 1994
Over the past year, the FUSE philosophy has been a distinct feature of
Yahoo!'s newest services. In February 2005, Yahoo! launched Yahoo! Web
Services, allowing outside developers to use, share, and expand Yahoo!
features. In March 2005, Yahoo! launched Yahoo! 360, a way for people to
share thoughts and information with friends and family, while expanding a
network of friends. In April 2005, Yahoo! introduced My Web, a way to save
and share search results while creating your own personal categorized
directory of the Web.
This book aims to help you FUSE Yahoo! features and services by
introducing you to little-known corners of Yahoo!, by reintroducing you to
familiar Yahoo! services, and by showing you examples of the many ways
people are expanding Yahoo! on their own. Though the hacks might be crude
and rude at times, they're written in the same spirit of sharing something
interesting that inspired the creation of Yahoo! in the first place.
Figure I-2. Yahoo! in 2005
Why Yahoo! Hacks?
The term hacking has a bad reputation in the press. They use it to refer
to someone who breaks into systems or wreaks havoc with computers as their
weapon. Among people who write code, though, the term hack refers to a
quick-and-dirty solution to a problem, or a clever way to get something
done. And the term hacker is taken very much as a compliment, referring to
someone as being creative, having the technical chops to get things done.
The Hacks series is an attempt to reclaim the word, document the good ways
people are hacking, and pass the hacker ethic of creative participation on
to the uninitiated. Seeing how others approach systems and problems is
often the quickest way to learn about a new technology.
While Yahoo! itself has been around for over 10 years, it is releasing new
applications, web sites, and software at a blinding pace. This book isn't
intended to catalog everything Yahoo! offers, but rather to introduce new
technologies, such as Yahoo! Web Services, while showing novel ways to use
perennial offerings like Yahoo! Search, Yahoo! Mail, and Yahoo! Groups.
Through the years, developers have scraped, poked, and prodded every
corner of Yahoo! for their own uses, and the release of Yahoo! Web
Services is like a welcome mat being put out for a wider audience of
would-be hackers. This book intends to show you what's possible when you
view Yahoo! as a platform and inspire your inner hacker to take a new look
at Yahoo!.
How to Use This Book
You can read this book from cover to cover if you like, but each hack
stands on its own, so feel free to browse and jump to the different
sections that interest you most. If there's a prerequisite you need to
know about, a cross-reference will guide you to the right hack.
How to Run the Hacks
The programmatic hacks in this book run either on the command line (that's
Terminal for Mac OS X folk, DOS command window for Windows users) or as
CGI (that's "common gateway interface") scriptsdynamic pages living on
your web site, accessed through your web browser.
Command-Line Scripts
Running a hack on the command line invariably involves the following
steps:
Type the program into a garden-variety text editor: Notepad on Windows,
TextEdit on Mac OS X, vi or Emacs on Unix/Linux, or anything else of the
sort. Save the file as directedusually as scriptname.pl (the pl bit
stands for Perl, the predominant programming language used in Yahoo!
Hacks).
Alternately, you can download the code for all of the hacks online at
http://www.oreilly.com/catalog/yahoohks, where there is a ZIP archive
containing individual scripts saved as text files.
Get to the command line on your computer or remote server. In Mac OS X,
launch the Terminal (Applications Utilities Terminal). In Windows, click
the Start button, select Run…, type command, and hit the Enter/Return
key on your keyboard. In Unix…well, we'll just assume you know how to
get to the command line.
Navigate to where you saved the script at hand. This varies from
operating system to operating system, but usually involves something
like cd~/Desktop (that's your Desktop on the Mac).
Invoke the script by running the programming language's interpreter
(e.g., Perl) and feeding it the script (e.g., scriptname.pl) like so:
$ perl scriptname.pl
Most often, you'll also need to pass along some parametersyour search
query, the number of results you'd like, and so forth. Simply drop them
in after the script name, enclosing them in quotes if they're more than
one word or if they include an odd character or three:
$ perl scriptname.pl '"much ado about nothing" script' 10
The results of your script are almost always sent straight back to the
command-line window in which you're working, like so:
$ perl scriptname.pl '"much ado about nothing" script' 10
1. "Amazon.com: Books: Much Ado About Nothing: Screenplay…" [http://
www.amazon.com/exec/obidos/tg/detail/-/0393311112?v=glance]
2. "Much Ado About Nothing Script" [http://www.signal42.com/much_ado_
about_nothing_script.asp]
…
The elllpsis (…) bit signifies that we've cut off the output
for brevity's sake.
To stop output scrolling off your screen faster than you can read it, on
most systems you can pipe (read: redirect) the output to a little
program called more:
$ perl scriptname.pl | more
Hit the Enter/Return key on your keyboard to scroll through line by
line, or the space bar to leap through page by page.
You'll also sometimes want to direct output to a file for safekeeping,
importing into your spreadsheet application, or displaying on your web
site. This is as easy as:
$ perl scriptname.pl > output_filename.txt
And to pour some input into your script from a file, simply do the
opposite:
$ perl scriptname.pl < input_filename.txt
Don't worry if you can't remember all of this; each command-line hack has
a "Running the Hack" section that shows you just how it's done.
CGI Scripts
CGI scriptsprograms that run on your web site and produce pages
dynamicallyare a little more complicated if you're not used to them. While
fundamentally they're the same sorts of scripts as those run on the
command line, they are more troublesome because setups vary so widely. You
might be running your own server, your web site might be hosted on an
Internet service provider's (ISP's) server, your content might live on a
corporate intranet serveror anything in between.
Since going through every possibility is beyond the scope of this (or any)
book, you should check your ISP's knowledge base, or call the ISP's
technical support department, or ask your local system administrator for
help.
Generally, though, the methodology is the same:
Type the program in to a garden-variety text editor: Notepad on Windows,
TextEdit on Mac OS X, vi or Emacs on Unix/Linux, or anything else of the
sort. Save the file as directedusually as scriptname.cgi (the cgi bit
reveals that you're dealing with a CGI script).
Alternately, you can download the code for all of the hacks online at
http://www.oreilly.com/catalog/yahoohks, where there is a ZIP archive
containing individual scripts saved as text files.
Move the script over to wherever your web site lives. You should have
some directory on a server somewhere in which all of your web pages (all
those .html files) and images (ending in .jpg, .gif, etc.) live. Within
this directory, you'll probably see something called a cgi-bin
directory: this is where a CGI script must usually live in order for the
server to run the script (rather than just displaying the script's text
in your web browser) when you visit its URL.
You usually need to "bless" CGI scripts as executableto be run rather
than displayed. Just how you do this depends on the operating system of
your server. If you're on a Unix/Linux or Mac OS X system, this usually
entails typing the following on the command line:
$ chmod 755 scriptname.cgi
Now you should be able to point your web browser at the script and have
it run as expected, behaving in a manner similar to that described in
the "Running the Hack" section of the hack at hand.
Just what URL you use, once again, varies widely. It should, however,
look something like http://www.your_domain.com/cgi-bin/scriptname.cgi,
where your_domain.com is your web site domain, cgi-bin refers to the
directory in which your CGI scripts live, and scriptname.cgi is the
script itself.
If you don't have your own domain and are hosted at an ISP, the URL is
more likely to look like
http://www.your_isp.com/~your_username/cgi-bin/scriptname.cgi, where
your_isp.com is your ISP's domain, ~your_username is your username at
the ISP, cgi-bin refers to the directory in which your CGI scripts live,
and scriptname.cgi is the script itself.
If you come up with something called an "internal server error" or see the
error code 500, something's gone wrong somewhere in the process. At this
point you can take a crack at debugging (read: shaking the bugs out)
yourself or ask your ISP or system administrator for help.
Debuggingespecially CGI debuggingcan be a little more than the average
newbie can bear, but there is help in the form of a famous frequently
asked question (FAQ) archive: "The Idiot's Guide to Solving Perl CGI
Problems." Search for it and step through as directed.
Learning to Code
Fancy trying your hand at a spot of programming? O'Reilly's best-selling
Learning Perl (http://www.oreilly.com/catalog/lperl3), by Randal L.
Schwartz and Tom Phoenix, provides a good start. Apply what you learn to
understanding and using the hacks in this book, perhaps even taking on the
"Hacking the Hack" sections to tweak and fiddle with the scripts. This is
a useful way to get a little programming under your belt if you're a
searching nut, since it's always a little easier to learn how to program
when you have a task to accomplish and existing code to leaf through.
How This Book Is Organized
The book is divided into several chapters, organized by subject:
Chapter 1, Search
This chapter shows you how to become a Yahoo! power searcher by taking
advantage of meta keywords to return more relevant results. You'll also
see how to use search shortcuts to find instant answers to some common
questions. This chapter tells you how to find popular search phrases and
technologies by analyzing Yahoo! Buzz, and we'll pit Yahoo! against Google
to see which search engine returns the most relevant results.
Chapter 2, Services
Yahoo! offers information about everything from stocks and bonds to movie
and TV schedules. This chapter shows some unique ways to use Yahoo! Web
Services, including monitoring your commute for problems, watching TV
schedules automatically for appearances by your favorite celebrities, and
visualizing your music collection.
Chapter 3, Communicating
Use the hacks in this chapter to reach out and touch someone. You'll find
hacks for managing your Yahoo! Mail, collaborating with Yahoo! Groups, and
exploring your social networks with Yahoo! 360. This chapter also shows
some ways to personalize Yahoo! Messenger and share your photos with the
world.
Chapter 4, Web Services
This chapter introduces you to the back door that Yahoo! has opened for
developers. You'll find bare-bones examples in several scripting languages
that can give you a head start to creating your own Yahoo!-powered
applications.
Chapter 5, Applications
See how people are using Yahoo! data in their own applications and have a
bit of fun in the process. Find out how to randomize your desktop
background with images from across the Web and how to integrate Yahoo!
with Excel and Outlook.
Chapter 6, Webmastering
If you publish on the Web, you're well aware of the traffic Yahoo! can
send to your site. This chapter shows how to get listed and introduces you
to other Yahoo! components you can plug into your site.
Conventions Used in This Book
The following is a list of the typographical conventions used in this
book:
Italics
Used to indicate URLs, filenames, filename extensions, and directory
names. For example, a path in the filesystem will appear as
/Developer/Applications.
Constant width
Used to show code examples, the contents of files, and console output, as
well as the names of variables, commands, and other code excerpts.
Constant width bold
Used to highlight portions of code, typically new additions to old code.
Also used to show text you should type literally at a command-line prompt.
Constant width italic
Used in code examples and other excerpts to show sample text to be
replaced with your own values.
Gray type
Used to indicate a cross-reference within the text.
A carriage return () at the end of a line of code is used to denote an
unnatural line break; that is, you should not enter these as two lines of
code, but as one continuous line. Multiple lines are used in these cases
due to page-width constraints.
You should pay special attention to notes set apart from the text with the
following icons:
This is a tip, suggestion, or general note. It contains useful
supplementary information about the topic at hand.
This is a warning or note of caution, often indicating that
your money or your privacy might be at risk.
The thermometer icons, found next to each hack, indicate the relative
complexity of the hack:
beginner moderate expert
Using Code Examples
This book is here to help you get your job done. In general, you may use
the code in this book in your programs and documentation. You do not need
to contact us for permission unless you're reproducing a significant
portion of the code. For example, writing a program that uses several
chunks of code from this book does not require permission. Selling or
distributing a CD-ROM of examples from O'Reilly books does require
permission. Answering a question by citing this book and quoting example
code does not require permission. Incorporating a significant amount of
example code from this book into your product's documentation does require
permission.
We appreciate, but do not require, attribution. An attribution usually
includes the title, author, publisher, and ISBN. For example: "Yahoo!
Hacks by Paul Bausch. Copyright 2006 O'Reilly Media, Inc., 0-596-00945-3."
If you feel your use of code examples falls outside fair use or the
permission given above, feel free to contact us at
permissions@oreilly.com.
Safari Enabled
When you see a Safari® Enabled icon on the cover of your favorite
technology book, that means the book is available online through the
O'Reilly Network Safari Bookshelf.
Safari offers a solution that's better than e-books. It's a virtual
library that lets you easily search thousands of top tech books, cut and
paste code samples, download chapters, and find quick answers when you
need the most accurate, current information. Try it for free at
http://safari.oreilly.com/.
How to Contact Us
We have tested and verified the information in this book to the best of
our ability, but you may find that features have changed (or even that we
have made mistakes!). As a reader of this book, you can help us to improve
future editions by sending us your feedback. Please let us know about any
errors, inaccuracies, bugs, misleading or confusing statements, and typos
that you find anywhere in this book.
Please also let us know what we can do to make this book more useful to
you. We take your comments seriously and will try to incorporate
reasonable suggestions into future editions. You can write to us at:
O'Reilly Media, Inc.1005 Gravenstein Hwy N.Sebastopol, CA 95472(800)
998-9938 (in the U.S. or Canada)(707) 829-0515 (international/local)(707)
829-0104 (fax)
To ask technical questions or to comment on the book, send email to:
bookquestions@oreilly.com
The web site for Yahoo! Hacks lists examples, errata, and plans for future
editions. You can find this page at:
http://www.oreilly.com/catalog/yahoohks
For more information about this book and others, see the O'Reilly web
site:
http://www.oreilly.com/
Got a Hack?
To explore Hacks books online or to contribute a hack for future titles,
visit:
http://hacks.oreilly.com/
Chapter 1. Search
Section 1.1. Hacks 122: Introduction
Hack 1. Fine-Tune Yahoo! Web Search Queries
Hack 2. Save Time with Search Shortcuts
Hack 3. Create a Yahoo! ID
Hack 4. Set Persistent Yahoo! Search Preferences
Hack 5. Assemble Advanced Search Queries
Hack 6. Translate Any Page with Yahoo!
Hack 7. Personalize, Track, and Share the Web
Hack 8. Prefetch Yahoo! Search Results
Hack 9. Compare Yahoo! and Google Search Results
Hack 10. Find Content You Can Reuse Legally
Hack 11. Find Video from Across the Web
Hack 12. Streamline Browsing with the Yahoo! Toolbar
Hack 13. Customize the Firefox Quick Search Box
Hack 14. Spot Trends with Yahoo! Buzz
Hack 15. Find Hot Technologies at the Buzz Game
Hack 16. Tame Long Yahoo! URLs
Hack 17. Opt Out of Advertiser Cookies
Hack 18. Track News About Yahoo!
Hack 19. Spider the Yahoo! Catalog
Hack 20. Browse the Yahoo! Directory
Hack 21. Track Additions to Yahoo!
Hack 22. Yahoo! Directory Mindshare in Google
1.1. Hacks 122: Introduction
Many of us use search engines in the same way we we use street signs. We
use them to navigate, to get our bearings, and to pinpoint our
destination. We rarely stop to consider the signs themselves or look for
more information they might be telling us. As with street signs, we'd be
lost without search engines, and by taking a few minutes to contemplate
the Yahoo! Web Search results page, you might find new ways to reach your
destination.
Take a look at Figure 1-1, which shows a Yahoo! Web Search results page
for the query ancient greece.
Figure 1-1. Yahoo! Web Search results
You can see the familiar numbered listing of search results, but there are
a number of other bits of information on the page. Here's a look at what's
available on a Yahoo! Search results page:
Navigation bar
You'll find the gray navigation bar at the top of the page on many pages
at Yahoo! sites. The bar provides a consistent way to get to the main
Yahoo! page (http://www.yahoo.com/), the My Yahoo! portal [Hack #34], and
Yahoo! Mail [Hack #52]. The bar also indicates your login status by
displaying your Yahoo! ID [Hack #3] or Guest, along with links that let
you sign in to Yahoo! or sign out. You can also click the Help link at the
far right of the navigation bar to read documentation about the site.
Search links
Just above the search form, you'll find links to other Yahoo! searches,
including Images, Video [Hack #11], the Yahoo! Directory [Hack #20],
Yahoo! News [Hack #32], and Yahoo! Shopping [Hack #47]. You can click any
of these search links to search with the exact query you used at one of
the other Yahoo! Search properties so that you don't have to retype your
search term.
Result count
Search results are returned as a number of pages, and you'll find your
position within the results in the shaded blue bar. For instance, the
first page of results will be labeled as Results 110, the second page will
show Results 1120, and so on. (You can adjust the number of results per
page by setting your search preferences [Hack #4].) You'll also see the
estimated total number of results for your query.
Query definition links
Just to the right of the result count, you'll see the words in the query
as links. You can click the links to see dictionary definitions of the
words at Yahoo! Reference [Hack #40].
Search speed
The shaded blue bar will also show you how long it took to fetch the
results, usually less than a half-second.
Sponsor results
You'll find context-sensitive advertising along the right side of the page
and in a shaded blue box above or below the Yahoo! Web Search results.
Advertising is always clearly labeled Sponsor Results, and the type of ads
will be triggered by the topic you're searching for.
Search suggestions
Search phrases similar to the one you entered are labeled with Also Try:
at the top of the page. These suggestions show you what other Yahoo! users
are searching for related to your topic and can help you refine your
search. Yahoo! will display the top few suggestions, and if there are
several suggestions you can click the More or Show All links to see a
complete list of suggestions available.
Yahoo! shortcut info
If your query triggered a Yahoo! Shortcut [Hack #2], the shortcut info
will be shown above the Web results and marked with the Y! logo. Shortcuts
usually give you brief information about your query, with links to more
information at other Yahoo! properties.
Web results
The Web Search results show the familiar list of documents from across the
Web, which contain your query words or phrases. Each result is numbered
and includes the document title, a brief excerpt with query words in bold,
and the document location.
Results page
Below the Web Search results you can navigate between results pages by
clicking a page number or the Prev and Next links.
Each Yahoo! Web Search result represents a document somewhere on the Web.
The document will most likely be a web page written in HTML, but could be
in another format such as Adobe PDF, Microsoft Word, or plain text. Figure
1-2 shows a typical Yahoo! Web Search result with all of the associated
links and features.
Figure 1-2. A single Yahoo! Web Search result
A closer look at a Web Search result shows that there's more listed than
simply a document title and excerpt. Here's a look at what you'll find
with each result:
Document title
The document title is pulled from the document itself, either from HTML
tags within the document or from the first few words in the
document. Click the title to view the page or document.
New window link
To the right of the title is an icon showing two windows that you can
click to open the document in a new browser window. This option is handy
for keeping your search results in place while you read through pages of
the results in different windows.
Document excerpt
Just below the title, you'll find an excerpt of text from the document
with words or phrases from your query in bold. This helps you determine
the context of your search phrase and can tell you quickly whether the
document is relevant.
Category
If the document or page is listed in the Yahoo! Directory, you'll see the
category that page is listed in. You can click the category title to see
that category and view other sites that Yahoo! Editors have chosen to
include in the directory.
RSS
Many web publishers associate an RSS feed with their sites, which allows
readers to subscribe to site updates in programs called Newsreaders or at
sites such as My Yahoo! that pull content from other sources. When Yahoo!
detects the presence of a site feed, you'll find a link to view that feed
as raw XML or add the feed to My Yahoo! with a click.
URL
On the last line of the listing, you'll see the document URL in green with
any words from your query in bold. This tells you the domain the document
is hosted under, and you can tell from the top-level domain (.com, .edu,
.gov, etc.) whether the site is run by a business, a school, or the U.S.
government.
Size in bytes
Many results (such as those listed earlier in Figure 1-1) show the size of
the document in bytes, which can give you a rough idea of how long the
page will take to download. Web pages are usually fairly quick, but
Microsoft Word documents or Adobe PDF files might vary widely in size.
Cache
If Yahoo! has a copy of the document saved on its servers, you can click
the Cached link to view the copy. This is particularly useful if the site
isn't responding, as you can still get to an archived copy of the
information.
Other pages
The "More from this site" link will show you other pages at the domain
that match your query.
My Web links
Yahoo!'s My Web [Hack #7] lets you save sites that you want to remember,
or block sites that you never want to see in results again. You can use
the Save and Block links to add or remove documents.
Once you're aware of all the features of the Yahoo! Web Search results
page, you can make decisions about the best path to the information you're
after.
This chapter shows you how to take advantage of Yahoo! Web Search in a
number of different waysfrom using meta keywords for quick answers [Hack
#1] to viewing results in a radically different way [Hack #77].
Hack 1. Fine-Tune Yahoo! Web Search Queries
By understanding how to phrase your searches, you'll find more relevant
search results.
Using Yahoo! Web Search (http://search.yahoo.com/) is deceptively simple.
You can type in any word or phrase and find matches in documents across
the Web. The trade-off for this simplicity is having to look through
hundreds, thousands, or millions of results to find the documents that are
actually useful to you. By understanding how Yahoo! expects queries to be
phrased, you can limit the results to include only those documents most
relevant to yousaving you the time of looking through extraneous results.
1.2.1. Search Basics
To start building sophisticated queries, you need to know the basics. The
following search basics will help you refine your Yahoo! searches:
Keyword
By default, Yahoo! searches for all of the words you type into a search
form. If you type grammar into the search form, Yahoo! will return
documents that contain the word grammar. A search for grammar school will
return documents that contain both words somewhere within the document,
but not necessarily together.
Complete phrase
To search for words in a specific order, enclose the words in quotation
marks. A search for "grammar school" will return documents that contain
the complete phrase grammar school. You can combine keyword and phrase
searches. To find documents that contain the phrase grammar school and
also have the word Oregon somewhere in the document, you could search for
"grammar school" Oregon.
OR keyword
You can change the default behavior of keyword searches by using the
capitalized keyword OR between words. A search for grammar OR primary will
return documents that contain either grammar or primary, but not
necessarily both words.
Exclude words or phrases
To find documents without a certain word, you can use the minus sign (-)
along with the word you want to exclude. If a search for Oregon school
returns too many pages for schools in the city of Portland, you could type
Oregon school -Portland to exclude any pages with the word Portland from
the results.
Once you have the basics down, you can start mixing and matching, and
grouping queries together with parentheses. To find documents that contain
the word Oregon, and the phrase grammar school or the phrase elementary
school, you could type Oregon ("grammar school" OR "elementary school").
The parentheses are required to show where the OR should be used. Without
the parentheses, Yahoo! would look for documents that contain both the
word Oregon and the phrase grammar school, or documents that simply
contain the phrase elementary school. Because the word Oregon is necessary
across documents, the two secondary phrases need to be grouped into a
single unit with parentheses.
1.2.2. Search Meta Words
In addition to the basic operators, there are keywords that Yahoo! calls
Search Meta Words that you can use to refine your search:
site:
Use this keyword to limit search results to a single web site. You can
search for the word marsz across NASA sites by typing mars site:nasa.gov.
All of the results will be from sites hosted at the nasa.gov domain. You
also use this keyword to limit results to a single top-level domain, such
as .org, .com, or .edu. To find mentions of the word mars across academic
sites, type mars site:.edu.
hostname:
This keyword limits results to a specific host at a site. For example,
NASA's Mars Exploration Program has a web site at
http://mars.jpl.nasa.gov/. If you want to search this specific section of
the nasa.gov domain for the word rover, you could type rover
hostname:mars.jpl.nasa.gov.
link:
You can use this keyword to find sites that link to a specific URL. This
keyword works well if you want to judge the popularity of a specific page
by finding the number of other sites linking to a particular page. You'll
need to include the full URL, so to find pages that link to the Amazon
Hacks page at the O'Reilly Hacks site, type
link:http://www.oreilly.com/catalog/amazonhks/.
linkdomain:
Instead of a specific page, this keyword looks for any links to a specific
domain. If you're interested in pages that link to
http://www.oreilly.com/, type linkdomain:oreilly.com.
url:
This keyword lets you look up a single page at Yahoo! by specifying the
URL. You can look up the O'Reilly Hacks home page by typing
url:http://hacks.oreilly.com/. You could use this keyword to see how pages
at a site are displayed in Yahoo!'s Web, Images, and Video Search results.
inurl:
Use this keyword to find sites that have a specific word within the URL.
To find all sites that have the word mars in the URL, type inurl:mars.
intitle:
Like inurl:, this keyword returns documents that have a specific word in
the document title. To find documents with mars in the title, use
intitle:mars.
You can also use the basic search operators in combination with the Search
Meta Words to refine your search. Say you'd like to search for the word
mars across documents, but you don't want pages from any nasa.gov site;
type mars -site:nasa.gov. Because Yahoo! supports very long queries, you
could specify a whole list of sites that you don't want information from:
mars -site:nasa.gov -site:mars.com -site:space.com. But to search those
sites exclusively, take away the minus symbol, group the site list
together with parentheses, and use the OR keyword like this: mars
(site:nasa.gov OR site:mars.com OR site:space.com). Again, note that the
use of the OR keyword requires the use of parentheses.
Some of these query combinations can also be accomplished with the
advanced search form [Hack #5] available at
http://search.yahoo.com/web/advanced.
Hack 2. Save Time with Search Shortcuts
By using a few specific keywords, you can have Yahoo! answer common
questions within your search results, provide specific information, or
point directly to your answer.
At its most basic, Yahoo! Search allows you to type in search terms, click
the Search button, and receive documents that include that word or phrase
from across the Web. This makes Yahoo! a keyword search engine, and
knowing this can help you put together your queries.
Yahoo! Search accepts a number of key phrases that can provide quick
answers to common questions. To illustrate, here's an example in which
search shortcuts can give you a faster answer than keywords alone.
Imagine you're in California and you'd like to call a friend in London,
England. You can't remember the time difference and you don't want to call
at 3 a.m. London time, so you turn to Yahoo! for help. Browsing to
http://search.yahoo.com/, you find yourself in front of the search form,
about to type. What's the best query? If you were asking a human being for
the answer you might be tempted to type in a complete question: what is
the time in London?.
Because Yahoo! Search looks for matching words or phrases, you've told
Yahoo! to find documents that include the words in your phrase. So the top
results will likely be the web site for the London newspaper The Times and
other documents that contain the search terms London and time. You'll
probably find your answer at sites that are in the results, but there's a
much faster way to tell Yahoo! Search exactly what you're looking for.
Understanding the time zone and other search shortcuts will give you quick
answers to some common questions.
1.3.1. Yahoo! Search Shortcuts
When Yahoo! Search encounters a key phrase, Yahoo! tries to provide a
direct answer, in addition to matching documents that include the terms in
the phrase. For example, if you want to know the current time in London,
you can type time in London and you'll find the current time in London
above the search results, as shown in Figure 1-3.
Figure 1-3. An answer using a Yahoo! Search shortcut
By using this shortcut, you'll have the answer without looking through the
results or visiting other sites. Replace London with any city or with a
city-and-state combination, and you'll never have to worry about
calculating time zone differences again.
You'll know you've used a Yahoo! shortcut when you see a result at the top
marked with the Yahoo! Y!, as shown in Figure 1-3. You can browse a
complete, updated list of Yahoo! Search shortcuts at
http://tools.search.yahoo.com/shortcuts/. Here are a few of the shortcuts
available:
Definitions
Type define word, and Yahoo! will provide a brief dictionary definition
for the word and a link to the full dictionary entry for that word at
Yahoo! Reference [Hack #40].
Encyclopedia entries
Search for word facts, and Yahoo! will display an excerpt of the Columbia
Encyclopedia entry for that word and a link to the full entry.
Airport information
Yahoo! provides quick links to maps, flight information, and local weather
if you type airport code airport. For example, the shortcut for San
Francisco International Airport is SFO airport.
Hotels
Type city hotels to get a quick list of hotels in that city, along with
the Yahoo! Local rating, the base rate, and a link to check availability.
You can also look for a specific hotel chain by typing city chainfor
example, San Francisco Ramada.
Stock quotes
Type quote stock symbol to get the current trading price for a stock
(delayed 15 minutes). You can keep tabs on Yahoo! by typing quote yhoo.
Sports scores
Find out how your favorite pro team is doing by typing team-mascot scores.
You'll get a quick look at recent games, and sometimes you can see who
they're playing in the next game. The query 49ers scores will give you
information about the San Francisco 49ers football team.
Movie showtimes
To see when movies are playing in your area, type showtimes Zip Code and
you'll get links to local theater showtimes and a few showtimes for
current movies.
Zip Codes
You can find all of the Zip Codes for a city by typing zip code city.
Area codes
If you're not sure where someone is calling from, try typing the
three-digit area code into Yahoo! Search. Yahoo! will return a list of
cities in that area code.
Weather
For a quick look at the current weather for any city, type city weather.
Yahoo! will give you the current conditions and the expected high and low
temperatures.
Once you learn how to speak the Yahoo! Search shortcut language, you'll
save time answering some basic questions.
1.3.2. Yahoo! Properties Shortcuts
Another set of shortcuts available via Yahoo! Search forms are shortcuts
to Yahoo! properties. Say you want to get to Yahoo! Movies but can't
remember the URL. You can simply type movies! into any search form, and
you'll automatically be redirected to Yahoo! Movies
(http://movies.yahoo.com/).
The exclamation point at the end lets Yahoo! know you're looking for a
Yahoo! property.
There are hundreds of Yahoo! properties, and most of the shortcuts are
intuitive. Here's a list of a few Yahoo! properties, along with their URLs
and shortcuts:
Table 1-1.
Property
URL
Shortcut
Yahoo! Mail
http://mail.yahoo.com/
mail!
Yahoo! Games
http://games.yahoo.com/
games!
Yahoo! News
http://news.yahoo.com/
news!
Yahoo! Sports
http://sports.yahoo.com/
sports!
Yahoo! Finance
http://finance.yahoo.com/
finance!
Yahoo! Address Book
http://address.yahoo.com/
address!
Yahoo! Calendar
http://calendar.yahoo.com/
calendar!
Yahoo! Education
http://education.yahoo.com/
education!
Yahoo! Next
http://next.yahoo.com/
next!
Keep in mind that you can use these Yahoo! properties shortcuts from any
Yahoo! Search form, including the Yahoo! Toolbar form and the Firefox
quick search box.
Hack 3. Create a Yahoo! ID
The key to many of the services at Yahoo! is a unique Yahoo! ID, and
understanding how IDs work is key to keeping your Yahoo! ID private.
A Yahoo! ID is what distinguishes you from the crowd and what lets Yahoo!
remember you across browsing sessions and across computers. If you've been
using the Web for any amount of time, chances are good that you already
have a Yahoo! ID. In November 2004, Nielsen/Netratings estimated that 55
million people around the world use Yahoo! Mail, and all of them sign in
with a Yahoo! ID.
1.4.1. Signing Up
If you don't already have a Yahoo! ID, you can create one in less than
five minutes. Browse to http://login.yahoo.com/ and click Sign Up Now for
the new account form.
The most important decision to make as you fill out the new account form
is what your Yahoo! ID will be. You'll use your ID anytime you want to
access your personalized Yahoo! data, and your ID will determine what your
Yahoo! Mail email address will be. If your Yahoo! ID is j0d00d, your email
address is j0d00d@yahoo.com. The hardest part is finding an ID that is
different from the 55 million Yahoo! IDs that already exist. The next
hardest part is keeping the ID short and memorable. Keep in mind that
you'll use this ID anytime you want to log in to Yahoo!. A short ID will
save your fingers some work if you plan to log in to Yahoo! from your cell
phone. And friends might want to contact you with Yahoo! Instant Messenger
via your Yahoo! ID, so a short ID that is similar to your name will help
them remember it.
Before filling out the form, go straight to the Yahoo! ID field and start
trying potential IDs. Click the Check Availability of This ID button until
you find something that's not taken. If you can get something with your
initials or first and last name, consider yourself lucky.
When it's time to choose your password, it's tempting to recycle a
password that you use in other places. Your Yahoo! ID and password is the
only thing protecting your email from unauthorized readers, so it's a good
idea to make the password unique and somewhat complex. Yahoo! requires at
least six characters, but you can do better than that. A complex password
should include upper-and lowercase letters, as well as symbols or numbers.
A good trick for creating long, memorable passwords that are hard for
hackers to guess is to think of the first line of your favorite poem or
song and choose the first letter of each word as your password. So "Mary
had a little lamb, its fleece was white as snow" would translate into the
password Mhallifwwas. Add a memorable number, such as the year you were
born, to the end and you'll have something like Mhallifwwas1973, which
looks completely random but has meaning for you.
If you find yourself keeping track of several dozen unique
passwords, you might want to consider using a password manager
to store them securely in one place. You can download the
freely available Password Safe program for Windows at
http://passwordsafe.sourceforge.net/just be sure not to forget
the master password! Mac and Linux users may want to try
Password Gorilla, available at
http://www.fpx.de/fp/Software/Gorilla/.
If you ever forget your Yahoo! password, you can always reset it later, in
a couple of different ways. If you provide an alternate email address
during this process, you'll be able to verify that address and have the
ability to reset your password at any time. But if you want a bit more
anonymity and don't want to provide an alternate email, be sure to
remember the answer you give to the security question when you sign up.
Your answer will be your only key to recovering your password and any
information associated with your account if you ever forget your password.
As you're finishing up the registration process, you'll notice an image
with wavy numbers and letters, like the one in Figure 1-4.
Figure 1-4. Yahoo! Registration captcha equal to "6z3e"
The image is called a captcha, and Yahoo! uses them to keep spammers from
automatically creating Yahoo! accounts. If you can discern the numbers and
letters in the graphic, you will prove to Yahoo! that you are a human
rather than an automated program. The captcha can be difficult to read
sometimes, and if you can't make out the letters and numbers, it doesn't
mean you're not a human. Simply reload the page to get a differentand
hopefully more readablecaptcha.
1.4.2. Signing In
If you just created your account, you'll be logged in and ready to use any
of Yahoo!'s applications. But from time to time, you'll need to sign in.
Again, your Yahoo! ID and password are your keys to security, so you
should do what you can to protect these. Before you log in, you can
protect this information by switching to a secure connection, as follows.
Underneath the login form, you'll find a text link labeled MODE:, which
you can use to switch to a secure connection. Clicking the link, you'll
find that the URL in the address bar begins with https: instead of the
standard http: and you'll see a padlock icon in the lower status bar, as
shown in Figure 1-5.
Firefox users will have the added indication of a yellow
address bar when browsing a secure page.
The default login form uses a standard connection, and making this small
switch to the secure SSL connection will ensure that your Yahoo! ID and
password combination are hidden from prying eyes. But it's important to
note that the rest of your Yahoo! activities will not be encrypted, even
if you log in securely. Yahoo! uses a standard connection for most of its
services, including email. If you're ever wondering whether the current
page you're visiting is secure, check for the padlock icon in the
lower-right corner of your browser.
Figure 1-5. Yahoo! secure login page
Checking the "Remember my ID on this computer" box sets a cookie in your
browser that lets Yahoo! remember your ID between browsing sessions. Even
with this option checked, Yahoo! will occasionally ask you to verify your
password, so keep it handy if you don't have your password memorized. If
you change your mind and no longer want Yahoo! to remember your ID on your
computer, you can simply sign out.
1.4.3. Signing Out
At the top of most pages at Yahoo!, you'll find a welcome message that
includes your Yahoo! ID, as shown in Figure 1-6.
Figure 1-6. Welcome message with Sign Out link
Under your ID, you'll find a Sign Out link that you can click anytime to
sign out of Yahoo! If you share your computer with others or visit Yahoo!
from a public computer, it's always a good idea to sign out when you're
done using Yahoo!. Signing out will help ensure that your personal
dataeverything from financial information to private emailstays personal.
1.4.4. Removing Your Account
If you ever want to part ways with Yahoo!, you can visit
https://edit.yahoo.com/config/delete_user to remove your account
completely. You'll permanently lose access to any personal data you may
have assembled (such as email) and any personal preferences (such as news
sources at My Yahoo!). Weigh this option carefully before proceeding,
because it's a permanent change, and you won't be able to recover your
unique Yahoo! ID in the future. You'll need to enter your password a final
time on this page and then click "Terminate this account."
Hack 4. Set Persistent Yahoo! Search Preferences
Tweak your Yahoo! preferences to get the most out of your searching.
If you already have a Yahoo! ID, you can set some preferences that will
affect the appearance and content of your Yahoo! searches. To set your
preferences, first make sure you're logged in to Yahoo! by visiting
http://login.yahoo.com/ and entering your Yahoo! ID and password. From
there, browse to http://www.yahoo.com/ or http://search.yahoo.com/ and
look for the Preferences link to the right of the search form, like the
one highlighted in Figure 1-7.
Figure 1-7. Yahoo! Search Preferences link
If you don't see the preferences link, you can browse directly to
http://search.yahoo.com/preferences. From the Preferences page, you can
set a number of options that Yahoo! will remember and apply to any search
results in the future.
1.5.1. New Window
When searching a particular topic, it's easy to click on a search result,
get lost in reading, and find yourself several clicks away from your
original page of search results. If you find yourself clicking your
browser's Back button again and again to get back to your Yahoo! search
results, you might want to open links from the search results page in a
new browser window. You can set this preference by checking the New Window
box on the Preferences page. This is handy for keeping your search results
page in place, allowing you to browse other sites without fear of losing
your search results.
1.5.2. Number of Results
By default, Yahoo! shows 20 results on each page. You can change this
setting on the Preferences page to 10, 15, 20, 30, 40, or 100 results.
Setting it to display fewer results per page will keep your scrolling to a
minimum, but if you have a large screen you might appreciate seeing up to
a hundred results without clicking through several pages.
1.5.3. Adult Content Filtering
As in other media, the Web is filled with material that isn't appropriate
for children or the workplace. Yahoo! indexes the entire Webincluding the
seamier sectionsand Yahoo!'s answer to this dilemma is the SafeSearch
Filter. With SafeSearch enabled, Yahoo! will do its best to exclude any
adult material from search results. There are three different settings you
can apply to your Yahoo! ID:
Filter out adult Web, video, and image search results
This enables SafeSearch across every type of Yahoo! Search that has adult
content.
Filter out adult video and image search results only
This enables SafeSearch for video and image searches at Yahoo!, but Web
searches might still contain adult material.
Do not filter results
This setting completely disables SafeSearch, and adult material will be
included in Yahoo! Search results.
The default setting is "Filter video and image search," so even if you
never visit your Yahoo! Preferences page, SafeSearch is working behind the
scenes.
In addition to choosing a filter level, you can lock a SafeSearch setting
for a specific browser. When you check the SafeSearch Lock checkbox and
update your preferences, Yahoo! sets a cookie for your browser that will
keep your SafeSearch setting for every Yahoo! ID that uses that browser.
If you have children in the house and they share your web browser, this is
a way to keep adult material from them.
Because the SafeSearch Lock is tied to a particular browser rather than a
particular Yahoo! ID, it functions a bit differently from the other
settings. If another user logs in with a different Yahoo! ID using the
same browser, she'll be able to change the SafeSearch Lock setting.
However, if the particular Yahoo! ID has an age set and the user is listed
as under 18, the SafeSearch Lock option will be hidden from view.
1.5.4. Language
Yahoo! keeps track of files and web pages on servers across the world and
notes the language of each page in its index. You can specify that you'd
like to receive results in all, one, or a custom combination of the many
available languages. You've probably stumbled across pages in a language
you don't understand before, and you can save some time by excluding these
from your search results. Figure 1-8 shows the current list of languages
that Yahoo! lets you choose from, and you can select one or more from the
list.
Figure 1-8. The list of languages at Yahoo!
By default, Yahoo! displays results in any language. Of course, English
search terms generally return web pages in English, but without setting
this preference, you'll probably run into pages in other languages from
time to time. For example, my last name is a common German last name, so a
search for "Paul Bausch" yields both English and German pages.
Hack 5. Assemble Advanced Search Queries
By understanding how Yahoo! Advanced Search URLs are structured, you can
create your own Advanced Search queries on the fly.
In addition to the simple search form you'll find at
http://search.yahoo.com/, Yahoo! offers an Advanced Web Search form at
http://search.yahoo.com/web/advanced. This form lets you refine your
search in a number of ways, so you can narrow the results to a more useful
list.
For example, if you'd like to find information about a generic topic, such
as astronomy, you could go to Yahoo!, type astronomy into the search form,
and find hundreds of sites related to the word. But if you want only a
segment of those results, you can browse over to the Advanced Web Search
form, type astronomy, and limit the results by top-level domain, as shown
in Figure 1-9.
Figure 1-9. Yahoo! Advanced Search form
A search for astronomy across .gov sites returns only pages at NASA's web
site. The same search limited to .edu sites results in astronomy programs
at various universities, and limiting to .com gives you astronomy
magazines at the top of the results.
You can further refine your search by limiting it to a specific file
format, such as PDF files, Excel spreadsheets, or XML files. For any given
search, you can also override your global preferences settings for
language, number of results, and adult content filtering.
1.6.1. Anatomy of an Advanced Search URL
To get started with hacking URLs, type a term into the Advanced Web Search
form and click the Yahoo! Search button, which will take you to the
results page. Once there, note the insanely long URL in the address of
your browser. It will look something like this:
http://search.yahoo.com/search?_adv_prop=web&x=op&ei=UTF-8&va=astronomy&va_
vt=any& vp_vt=any&
vo_vt=any&ve_vt=any&vd=all&vst=.gov&vs=.gov&vf=all&vm=p&
fl=0&n=20
For any given search URL, some of the variables you'll find in the URL are
redundant or not necessary. The web form basically acts as a URL-building
tool that has assembled this URL for you, and it isn't picky about which
variables it includes. By understanding the pieces of the URL, you can
construct your own queries using shorter URLs without the form.
Note that the domain is followed by /search?, followed by a series of
variable/ value pairs separated by ampersands. Not all of these variables
will affect the search results, but there are some that are useful to play
with. The variables are a bit cryptic (to keep the URLs as short as
possible), so here's a list of the relevant variables and what they
represent.
The v* variables represent the way you'd like Yahoo! to handle the phrase.
You can choose from the following variables:
Table 1-2.
va
Use this variable when you're looking for all of the words in a
particular query. A query with the value astronomy magazine finds
pages that contain both astronomy and magazine.
vp
This variable holds the search query when you want to match a
specific phrase, so a query with the value astronomy magazine finds
pages that contain the exact phrase astronomy magazine.
vo
This variable indicates a search for any of the words in a
particular query. So a query with the value astronomy magazine
returns documents that contain either astronomy or magazine.
ve
This variable indicates words that should not appear in any of the
pages, and it must be used with one of the other variables. For
example, combining one of the above queries with ve=NASA allows you
to search for astronomy magazine on pages that don't include the
term NASA.
Another group of similarly patterned variables lets you limit searching to
a specific part of a document, such as the title or URL. The format for
these variables is v*_vt, where the asterisk is replaced by the type of
primary search query. The possible values include any, title,or url. For
example, if you'd like to search for pages that have the exact phrase
astronomy magazine in the title, use the vp and vp_vt variables together,
like so:
search?vp=astronomy+magazine&vp_vt=title
If you'd like to limit your results to pages that have been updated
recently, you can use the vd variable. You can get all results, which is
the default, or limit them to pages updated within the last three months,
six months, or year. The respective values for these are all, m3, m6,or y.
So finding all documents that contain the phrase astronomy magazine that
have been updated within the last three months looks like this:
search?vp=astronomy+magazine&vp_vt=any&vd=m3
The vs variable is useful for limiting searches to a top-level domain,
such as .com. In addition to top-level searches, you can narrow things to
a specific web site. If you want to find every mention of astronomy
magazine at the specific web site http://www.cnn.com/, you could use the
variable like this:
search?vp=astronomy+magazine&vp_vt=any&vs=cnn.com
The vf variable limits searches to a specific file type. Yahoo! supports a
set number of file types, and here are the current values you can use with
this variable:
all
The default value; returns any type of document
html
HTML documents
pdf
Adobe PDF files
xl
Microsoft Excel spreadsheets (note that this value is an abbreviation for
the full file extension, .xls)
ppt
Microsoft PowerPoint presentations
msword
Microsoft Word files
rss
Files formatted for syndication across web sites
text
Plain text files, which typically end with .txt
To continue with the example, say you want to find the phrase astronomy
magazine in only PowerPoint presentations. Append the vf variable, like
so:
search?vp=astronomy+magazine&vp_vt=any&vf=ppt
The number of results is controlled by the n variable, which can be set
only to some predetermined values: 10, 15, 20, 30, 40,or 100. To return
the first 40 results for the phrase astronomy magazine, add the n
variable, like so:
search?vp=astronomy+magazine&vp_vt=any&n=40
There are other variables in advanced search URLs, but these are a few
that will affect the content of search results. Now that you know why the
initial Advanced Web Search URL was so long, you can use some of the
variables to create your own advanced Yahoo! searches on the fly.
Hack 6. Translate Any Page with Yahoo!
The World Wide Web has pages in every language, and Yahoo! can help you
break through the language barrier.
Because the Web is a global space, we've all come across pages in
different languages, especially among search results. If you're searching
for information about a phrase like hamburger recipe, it's strange to come
across a page about it in German. It's stranger still to find a mention of
your name on a page in a foreign language. Imagine my surprise when I was
searching Yahoo! for my name and found it at the Russian site shown in
Figure 1-10.
Figure 1-10. Russian text with my name (Paul Bausch)
I can't read Russian, so of course I had no idea what the text said. I had
recently added a photo gallery of old radio dials to my web site; I could
tell they were linking to it, but I wanted to know what they were saying.
1.7.1. Yahoo! Language Tools
Yahoo!'s Language Tools page (http://tools.search.yahoo.com/language) has
some ways to help you work with other languages. Among them is a
translation service that will translate any block of text to a different
language. I copied the Russian text from Figure 1-10, pasted it into the
text area labeled "Translate this web text," chose "From Russian to
English" from the drop-down list of languages, and clicked Translate.
Yahoo! responded with this:
Radio Dials. The gallery of the photographs of ancient, I will not
beafraid this word, radios-scale. The author of collection,
photographerPaul Bausch, decided thus to publish the paternal collection
of radioreceivers. 3x, dreams about their own tsifrozerkalke with
themacro-objective become increasingly more importunately.
As you can see, the Yahoo! translation tool isn't perfect, but it's good
enough to give a sense of what the page is talking about. The translated
text refers to the "paternal collection" of photos, because the radios I
photographed belonged to my father. I still have no idea what the last
sentence of the translation means, but I'm closer to understanding now
than when it was in Russian.
If you'd like to limit the search results that Yahoo! returns
to one language or a handful of languages, you can set your
preferred languages in your search preferences. By default,
Yahoo! returns the best search results from any language.
A faster way to translate any page you find in Yahoo! Search results is
via the "Translate this page" link included within the results for
non-English pages. Figure 1-11 highlights the link in the search results.
Figure 1-11. The "Translate this page" link in Yahoo! Search results
Clicking the "Translate this page" link takes you to a translated version
of the page, rather than the page in its original language.
If you find yourself translating pages frequently, there are some ways to
speed up the process. You can translate an entire web page by copying and
pasting the URL into the field labeled "Translate this web page" on the
Yahoo! Language Tools page, choosing the language from the drop-down menu,
and clicking Translate. Yahoo! will display the page with all of the text
translated.
Another quick way to translate entire pages is with the Yahoo! Toolbar
[Hack #12]. If you've already installed the Yahoo! Toolbar, choose
Add/Edit Buttons… from the Toolbar Settings button to bring up the
Customize Yahoo! Toolbar page. Check the box next to Translate Current
Page under Search & Navigation and then click Finished. You should now see
a small yellow fish button, like the one shown in Figure 1-12, on your
toolbar.
Figure 1-12. The Translate button on the Yahoo! Toolbar
From any web page, you can click the Translate button and Yahoo! will
display a version in English. Yahoo! will also automatically detect the
source language, so you don't need to choose a language from a menu. This
is also handy if you can't tell what language the page is in. If you just
want to translate a block of text instead of the entire page, you can
click the arrow next to the fish and choose Language and Translation Tools
from the menu; you'll go to the Yahoo! Language Tools page, where you can
paste the text you want to translate into the translation form.
If the Yahoo! Toolbar isn't your style and copying and pasting into the
Language Tools isn't fast enough, you can create your own Translate button
with an understanding of Yahoo! Translation URLs and a JavaScript
bookmarklet.
1.7.2. A Translation Bookmarklet
If you visit the Yahoo! Language Tools page and translate a page by URL,
you'll end up at a Yahoo! page that uses frames. The top frame includes
the Yahoo! Search logo and several links: View Original, Print
Translation, Language Tools, and so on. The bottom frame is the original
web page, with all of the text translated into a different language.
Figure 1-13 shows such a translated page, with the O'Reilly Hacks page in
Spanish in the bottom frame.
Figure 1-13. The Hacks site translated into Spanish
Looking at the URL in the address bar, you'll see that you're at a Yahoo!
page with some parameters passed to it in the querystring, including the
URL of the page to be translated. The whole URL looks like this:
http://tools.search.yahoo.com/language/ translation/translatedPage.
php?tt=url& urltext=http%3A%2F%2Fhacks.oreilly.com%2F& lp=en_es
Here are the three variables passed in the URL:
tt
The type of translation to perform
urltext
The URL of the page to translate
lp
A code that represents the language to translate from and to
Knowing how to build Yahoo! Translate URLs, you can create a bookmarklet
to fetch the current page URL, construct the proper Yahoo! Translate URL,
and open it in a new window.
1.7.2.1. The code.
As with other Yahoo! bookmarklets throughout this book, this JavaScript is
not very readable, but is condensed to work within the confines of a
browser bookmark. Create a new bookmark in your browser and then bring it
up for editing. Put the following code into the location field of the
bookmark and be sure to give the bookmarklet a descriptive name, such as
Yahoo! Translate:
javascript:d=document;void(window.open('http://tools.search.yahoo.com/
language/
translation/translatedPage.php?tt=url&urltext='+escape(d.location.
href)+'&
lp=xx_en','_blank','width=640,height=480,status=yes,resizable=yes,
scrollbars=yes'))
The value of the lp variable in this code is important to note. The value
xx_en tells Yahoo! to determine the language of the page you've sent it to
translate. Of course, you could make this a language-specific bookmarklet
by replacing xx_en with es_en (Spanish to English), fr_de (French to
German), or any one of the other codes for the translations that Yahoo!
supports. To view a full list of translation codes, simply view the source
of the Language Tools page and look at the value attribute in the
Contents
Yahoo! Hacks
Table of Contents
Copyright
Credits
About the Author
Contributors
Acknowledgments
Preface
Why Yahoo! Hacks?
How to Use This Book
How to Run the Hacks
How This Book Is Organized
Conventions Used in This Book
Using Code Examples
Safari Enabled
How to Contact Us
Got a Hack?
Chapter 1. Search
Section 1.1. Hacks 122: Introduction
Hack 1. Fine-Tune Yahoo! Web Search Queries
Hack 2. Save Time with Search Shortcuts
Hack 3. Create a Yahoo! ID
Hack 4. Set Persistent Yahoo! Search Preferences
Hack 5. Assemble Advanced Search Queries
Hack 6. Translate Any Page with Yahoo!
Hack 7. Personalize, Track, and Share the Web
Hack 8. Prefetch Yahoo! Search Results
Hack 9. Compare Yahoo! and Google Search Results
Hack 10. Find Content You Can Reuse Legally
Hack 11. Find Video from Across the Web
Hack 12. Streamline Browsing with the Yahoo! Toolbar
Hack 13. Customize the Firefox Quick Search Box
Hack 14. Spot Trends with Yahoo! Buzz
Hack 15. Find Hot Technologies at the Buzz Game
Hack 16. Tame Long Yahoo! URLs
Hack 17. Opt Out of Advertiser Cookies
Hack 18. Track News About Yahoo!
Hack 19. Spider the Yahoo! Catalog
Hack 20. Browse the Yahoo! Directory
Hack 21. Track Additions to Yahoo!
Hack 22. Yahoo! Directory Mindshare in Google
Chapter 2. Services
Section 2.1. Hacks 2350: Introduction
Hack 23. Track Your Investments
Hack 24. Build Your Own Stock Update Email
Hack 25. Download Financial Data Using Excel Web Queries
Hack 26. Convert Currencies with One Click
Hack 27. Do the Math with Yahoo! Calculators
Hack 28. Add a Yahoo! Bookmark with One Click
Hack 29. Import Existing Bookmarks into Yahoo! Bookmarks
Hack 30. Open Yahoo! Bookmarks in a Sidebar
Hack 31. Publish Your Yahoo! Bookmarks
Hack 32. Track the Media's Attention Span over Time
Hack 33. Monitor the News with RSS
Hack 34. Personalize My Yahoo!
Hack 35. Track Your Favorite Sites with RSS
Hack 36. Add a Feed to My Yahoo! with a Right-Click
Hack 37. Build Your Own News Crawler
Hack 38. Replace Your Phone Book with Yahoo!
Hack 39. Monitor Your Commute
Hack 40. Get the Facts at Yahoo! Reference
Hack 41. Find and Rate Movies
Hack 42. Subscribe to Movie Showtimes
Hack 43. View Movie Lists on Your Cell Phone
Hack 44. Plan Your TV Viewing
Hack 45. Create a TV Watch List
Hack 46. Develop and Share a Trip Itinerary
Hack 47. Shop Intelligently
Hack 48. Visualize Your Music Collection
Hack 49. Take Yahoo! on the Go
Hack 50. Stay Connected with Yahoo! Alerts
Chapter 3. Communicating
Section 3.1. Hacks 5167: Introduction
Hack 51. Navigate Yahoo! Mail
Hack 52. Manage Yahoo! Mail
Hack 53. Create Yahoo! Mail Macros
Hack 54. Read All Your Email in One Place
Hack 55. Read Yahoo! Mail in Your Preferred Email Client
Hack 56. Manage and Share Your Schedule
Hack 57. Add Contacts to Your Yahoo! Address Book
Hack 58. Map Yahoo! Address Book Contacts
Hack 59. Discuss, Share, and Collaborate with Others
Hack 60. Archive Yahoo! Groups Messages with yahoo2mbox
Hack 61. Explore Your Social Networks
Hack 62. Import an Existing Blogroll to Yahoo! 360
Hack 63. Add an API to Your Yahoo! 360 Blog
Hack 64. Create a Yahoo! Avatar
Hack 65. Add a Content Tab to Yahoo! Messenger
Hack 66. Send Instant Messages Beyond Yahoo!
Hack 67. Store, Sort, and Share Your Photos
Chapter 4. Web Services
Section 4.1. Hacks 6876: Introduction
Section 4.2.
Hack 68. Program Yahoo! with Perl
Hack 69. Program Yahoo! with PHP 5
Hack 70. Program Yahoo! with Python
Hack 71. Program Yahoo! with VBScript
Hack 72. Program Yahoo! with ColdFusion
Hack 73. Program Yahoo! with XSLT
Hack 74. Program Yahoo! with Java
Hack 75. Program Yahoo! with Ruby
Hack 76. Program Yahoo! with REBOL
Chapter 5. Applications
Section 5.1. Hacks 7791: Introduction
Hack 77. Visualize Yahoo! Web Search Results
Hack 78. Find Links to Any Web Site
Hack 79. Import Yahoo! Local Listings into Your Address Book
Hack 80. Create a Yahoo! Local MIDlet
Hack 81. Import Yahoo! Local Listings into Excel
Hack 82. Spell Words with Yahoo! Images
Hack 83. Randomize Your Windows Desktop Background
Hack 84. Randomize Your Mac Desktop Background
Hack 85. Mash Up Images from Around the Web
Hack 86. Illustrate Any Web Site
Hack 87. Add Links to a Block of Text Automatically
Hack 88. Visualize News Topics as Tags
Hack 89. Get Related Terms Instantly with Ajax
Hack 90. Compare the Popularity of Related Search Terms
Hack 91. Plot Multiple Points on Your Own Map
Chapter 6. Webmastering
Section 6.1. Hacks 92100: Introduction
Hack 92. Get Your Site Listed at Yahoo!
Hack 93. Hide Part of Your Web Site from Yahoo!
Hack 94. Search Your Web Site with Yahoo!
Hack 95. Add Presence to Your Web Site
Hack 96. Syndicate Rich Media
Hack 97. Add Contextual Search to Your Blog
Hack 98. Post Photos to Your Blog
Hack 99. Feed Your Latest Photos to Your Web Site
Hack 100. Display Messages from a Yahoo! Group on Your Web Site
Colophon
Index
SYMBOL
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Yahoo! Hacks
By Paul Bausch
...............................................
Publisher: O'Reilly
Pub Date: October 2005
ISBN: 0-596-00945-3
Pages: 489
Table of Contents | Index
Yahoo! took the world by storm in the 1990s as a one-of-a-kind, searchable
list of interesting web sites. But ten years later, it has expanded into a
department store overflowing with useful and innovative tools and
services-from email, blogging, social networking, and instant messaging,
to news, financial markets, shopping, movie and TV listings, and much
more. Today's Yahoo! keeps you connected with every aspect of your life
and every corner of the Web.
Yahoo! Hacks shows you how to use, expand, personalize, and tweak Yahoo!
in ways you never dreamed possible. You'll learn how to:
Fine-tune search queries with keyword shortcuts and advanced syntax
Manage and customize Yahoo! Mail, using it as your universal email
client to access all your other accounts
Explore your social networks with Yahoo! 360, blogging your life,
keeping up with friends, and making new contacts
Store, sort, blog, feed, track, and otherwise share photos with Flickr
and RSS
Make My Yahoo! your Yahoo!, and personalize Yahoo!'s many properties
Roll your own Yahoo! applications with Yahoo! new Web Services API and
Perl, PHP, Java, Python, Ruby, or the programming language of your
choice
Visualize search results and topics, mash up images from around the Web,
and remix other web content
List (or hide) your site with Yahoo!, and integrate Yahoo! Groups,
Messenger, contextual search (Y!Q), or other Yahoo! features
Whether you want to become a power searcher, news monger, super shopper,
or innovative web developer, Yahoo! Hacks provides the tools to take you
further than you ever thought possible.
Yahoo! Hacks
By Paul Bausch
...............................................
Publisher: O'Reilly
Pub Date: October 2005
ISBN: 0-596-00945-3
Pages: 489
Table of Contents | Index
Copyright
Credits
About the Author
Contributors
Acknowledgments
Preface
Why Yahoo! Hacks?
How to Use This Book
How to Run the Hacks
How This Book Is Organized
Conventions Used in This Book
Using Code Examples
Safari Enabled
How to Contact Us
Got a Hack?
Chapter 1. Search
Section 1.1. Hacks 122: Introduction
Hack 1. Fine-Tune Yahoo! Web Search Queries
Hack 2. Save Time with Search Shortcuts
Hack 3. Create a Yahoo! ID
Hack 4. Set Persistent Yahoo! Search Preferences
Hack 5. Assemble Advanced Search Queries
Hack 6. Translate Any Page with Yahoo!
Hack 7. Personalize, Track, and Share the Web
Hack 8. Prefetch Yahoo! Search Results
Hack 9. Compare Yahoo! and Google Search Results
Hack 10. Find Content You Can Reuse Legally
Hack 11. Find Video from Across the Web
Hack 12. Streamline Browsing with the Yahoo! Toolbar
Hack 13. Customize the Firefox Quick Search Box
Hack 14. Spot Trends with Yahoo! Buzz
Hack 15. Find Hot Technologies at the Buzz Game
Hack 16. Tame Long Yahoo! URLs
Hack 17. Opt Out of Advertiser Cookies
Hack 18. Track News About Yahoo!
Hack 19. Spider the Yahoo! Catalog
Hack 20. Browse the Yahoo! Directory
Hack 21. Track Additions to Yahoo!
Hack 22. Yahoo! Directory Mindshare in Google
Chapter 2. Services
Section 2.1. Hacks 2350: Introduction
Hack 23. Track Your Investments
Hack 24. Build Your Own Stock Update Email
Hack 25. Download Financial Data Using Excel Web Queries
Hack 26. Convert Currencies with One Click
Hack 27. Do the Math with Yahoo! Calculators
Hack 28. Add a Yahoo! Bookmark with One Click
Hack 29. Import Existing Bookmarks into Yahoo! Bookmarks
Hack 30. Open Yahoo! Bookmarks in a Sidebar
Hack 31. Publish Your Yahoo! Bookmarks
Hack 32. Track the Media's Attention Span over Time
Hack 33. Monitor the News with RSS
Hack 34. Personalize My Yahoo!
Hack 35. Track Your Favorite Sites with RSS
Hack 36. Add a Feed to My Yahoo! with a Right-Click
Hack 37. Build Your Own News Crawler
Hack 38. Replace Your Phone Book with Yahoo!
Hack 39. Monitor Your Commute
Hack 40. Get the Facts at Yahoo! Reference
Hack 41. Find and Rate Movies
Hack 42. Subscribe to Movie Showtimes
Hack 43. View Movie Lists on Your Cell Phone
Hack 44. Plan Your TV Viewing
Hack 45. Create a TV Watch List
Hack 46. Develop and Share a Trip Itinerary
Hack 47. Shop Intelligently
Hack 48. Visualize Your Music Collection
Hack 49. Take Yahoo! on the Go
Hack 50. Stay Connected with Yahoo! Alerts
Chapter 3. Communicating
Section 3.1. Hacks 5167: Introduction
Hack 51. Navigate Yahoo! Mail
Hack 52. Manage Yahoo! Mail
Hack 53. Create Yahoo! Mail Macros
Hack 54. Read All Your Email in One Place
Hack 55. Read Yahoo! Mail in Your Preferred Email Client
Hack 56. Manage and Share Your Schedule
Hack 57. Add Contacts to Your Yahoo! Address Book
Hack 58. Map Yahoo! Address Book Contacts
Hack 59. Discuss, Share, and Collaborate with Others
Hack 60. Archive Yahoo! Groups Messages with yahoo2mbox
Hack 61. Explore Your Social Networks
Hack 62. Import an Existing Blogroll to Yahoo! 360
Hack 63. Add an API to Your Yahoo! 360 Blog
Hack 64. Create a Yahoo! Avatar
Hack 65. Add a Content Tab to Yahoo! Messenger
Hack 66. Send Instant Messages Beyond Yahoo!
Hack 67. Store, Sort, and Share Your Photos
Chapter 4. Web Services
Section 4.1. Hacks 6876: Introduction
Section 4.2.
Hack 68. Program Yahoo! with Perl
Hack 69. Program Yahoo! with PHP 5
Hack 70. Program Yahoo! with Python
Hack 71. Program Yahoo! with VBScript
Hack 72. Program Yahoo! with ColdFusion
Hack 73. Program Yahoo! with XSLT
Hack 74. Program Yahoo! with Java
Hack 75. Program Yahoo! with Ruby
Hack 76. Program Yahoo! with REBOL
Chapter 5. Applications
Section 5.1. Hacks 7791: Introduction
Hack 77. Visualize Yahoo! Web Search Results
Hack 78. Find Links to Any Web Site
Hack 79. Import Yahoo! Local Listings into Your Address Book
Hack 80. Create a Yahoo! Local MIDlet
Hack 81. Import Yahoo! Local Listings into Excel
Hack 82. Spell Words with Yahoo! Images
Hack 83. Randomize Your Windows Desktop Background
Hack 84. Randomize Your Mac Desktop Background
Hack 85. Mash Up Images from Around the Web
Hack 86. Illustrate Any Web Site
Hack 87. Add Links to a Block of Text Automatically
Hack 88. Visualize News Topics as Tags
Hack 89. Get Related Terms Instantly with Ajax
Hack 90. Compare the Popularity of Related Search Terms
Hack 91. Plot Multiple Points on Your Own Map
Chapter 6. Webmastering
Section 6.1. Hacks 92100: Introduction
Hack 92. Get Your Site Listed at Yahoo!
Hack 93. Hide Part of Your Web Site from Yahoo!
Hack 94. Search Your Web Site with Yahoo!
Hack 95. Add Presence to Your Web Site
Hack 96. Syndicate Rich Media
Hack 97. Add Contextual Search to Your Blog
Hack 98. Post Photos to Your Blog
Hack 99. Feed Your Latest Photos to Your Web Site
Hack 100. Display Messages from a Yahoo! Group on Your Web Site
Colophon
Index
Copyright © 2006 O'Reilly Media, Inc. All rights reserved.
Printed in the United States of America.
Published by O'Reilly Media, Inc., 1005 Gravenstein Highway North,
Sebastopol, CA 95472.
O'Reilly books may be purchased for educational, business, or sales
promotional use. Online editions are also available for most titles
(safari.oreilly.com). For more information, contact our
corporate/institutional sales department: (800) 998-9938 or
corporate@oreilly.com.
Table
Editor:
Brian Sawyer
Production Editor:
A. J. Fox
Series Editor:
Rael Dornfest
Cover Designer:
Hanna Dyer
Executive Editor:
Dale Dougherty
Interior Designer:
David Futato
Printing History:
October 2005:
First Edition.
Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are
registered trademarks of O'Reilly Media, Inc. The Hacks series
designations, Yahoo! Hacks, the image of boots and spurs, and related
trade dress are trademarks of O'Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish
their products are claimed as trademarks. Where those designations appear
in this book, and O'Reilly Media, Inc., was aware of a trademark claim,
the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the
publisher and author assume no responsibility for errors or omissions, or
for damages resulting from the use of the information contained herein.
Small print: The technologies discussed in this publication, the
limitations on these technologies that technology and content owners seek
to impose, and the laws actually limiting the use of these technologies
are constantly changing. Thus, some of the hacks described in this
publication may not work, may cause unintended harm to systems on which
they are used, or may not be consistent with applicable user agreements.
Your use of these hacks is at your own risk, and O'Reilly Media, Inc.
disclaims responsibility for any damage or expense resulting from their
use. In any event, you should take care that your use of these hacks does
not violate any applicable laws, including copyright laws.
This book uses RepKover™, a durable and flexible lay-flat binding.
ISBN: 0-596-00945-3
[C]
Credits
About the Author
Contributors
Acknowledgments
About the Author
Paul Bausch is an independent web developer living in Corvallis, Oregon.
When he's not hacking together web applications, he's writing about
hacking together web applications. He put together Amazon Hacks for
O'Reilly in 2003. Paul also helped create the popular weblog application
Blogger (http://www.blogger.com/), cowrote a book about weblogs called We
Blog: Publishing Online with Weblogs (Wiley), and maintains a directory of
Oregon weblogs called ORblogs (http://www.orblogs.com/). When he's not
working on a book, Paul posts thoughts and photos to his personal weblog,
onfocus (http://www.onfocus.com/).
Contributors
The following people contributed their hacks, writing, and inspiration to
this book:
Jacek Artymiak (http://www.artymiak.com/) is a freelance consultant,
developer, and writer. He's been programming computers since 1986,
starting with the Sinclair ZX Spectrum. His interests include network
security, computer graphics and animation, and multimedia. Jacek lives
in Lublin, Poland, with his wife, Gosia, and can be reached at
jacek@artymiak.com.
Bonnie Biafore is the author of several books about personal finance,
investing, and project management. As an engineer, she's tenaciously
attentive to detail and digests tantalizing morsels about every topic
she approaches. Her sick sense of humor turns subjects that are
droolinducing in other books into entertaining, easy reading. Her book
the NAIC Stock Selection Handbook won major awards from both the Society
of Technical Communication and APEX Awards for Publication Excellence,
but she cherishes the raves she's received from beginning investors most
of all. She is also the author of Online Investing Hacks (O'Reilly) and
QuickBooks 2005: The Missing Manual (O'Reilly). Bonnie writes a monthly
column called WebWatch for Better Investing magazine and is a regular
contributor to WomensWallStreet.com. As a consultant, she manages
projects for clients and wins accolades for her ability to herd cats.
When not chained to her computer, she hikes in the mountains with her
dogs, cooks gourmet meals, and practices saying no to additional work
assignments. You can learn more at Bonnie's web site,
http://www.bonniebiafore.com/, or email her at bonnie.biafore@gmail.com.
Tara Calishain is the editor of ResearchBuzz
(http://www.researchbuzz.com/), a weekly newsletter on Internet
searching and online information resources. She's also a regular
columnist for Searcher magazine. She's been writing about search engines
and searching since 1996; her recent books include Google Hacks
(O'Reilly) and Web Search Garage (O'Reilly).
Kevin Hemenway (http://www.disobey.com/), better known as Morbus Iff, is
the creator of Disobey.com, which bills itself as "content for the
discontented." Publisher, developer, and writer of more home cooking
than you could ever imagine (like the popular open sourced syndicated
reader AmphetaDesk, the best-kept gaming secret Gamegrene.com, the
popular Ghost Sites and Nonsense Network, the giggle-inducing articles
at the O'Reilly Network, a few pieces at Apple's Internet Developer
site, etc.), he's an ardent supporter of cloning, merely so he can get
more work done. He cooks with a Fry Pan of Intellect +2 and lives in
Concord, New Hampshire.
Ryan Kennedy is a software engineer at Yahoo!, working on Yahoo! Mail.
In his spare time, he maintains the Yahoo! Java Search SDK.
Philipp Lenssen lives in Stuttgart, Germany, where he blogs about
Google, works as a programmer on an automobile web site, and eats spicy
Thai food with his girlfriend. He likes to ponder future technology and
jump on any technology bandwagon that seems worthwhile, especially all
the APIs that make a developer's life that much easier. Philipp's daily
musings can be found at http://blog.outer-court.com/.
Mikel Maron is an independent software developer and ecologist. He has
built several geographic-oriented projects around the worldKit mapping
package, including World as a Blog and mapufacture. Previously, he led
development of My Yahoo! in the pre-RSS days. Mikel was awarded a
master's degree from the University of Sussex for building a simulation
of the evolution of complexity in food webs. Originally from California,
Mikel is presently based mostly in Brighton, United Kingdom, with his
wife, Anna. Links to various things can be found at
http://brainoff.com/.
Deepak Nadig is an entrepreneur and has helped build innovative and
useful products for 14 years. He is currently taking a break after
cofounding and selling Covigna, a pioneer in Contract Lifecycle
Management.
Todd Ogasawara focuses on Mobile Workforce and Mobile Lifestyle
technology, paying special attention to the Microsoft Windows Mobile
platform (Pocket PC and Smartphone). Microsoft has recognized his
demonstrated practical expertise and willingness to share his experience
by recognizing him as a Microsoft Most Valuable Professional (MVP) in
the Mobile Devices category since 2000. His other technology focus is in
the effort to bring commercial (especially Microsoft-related) products
and GNU/Open Source software together in a synergistic and productive
way. Todd has written several articles about mobile devices, digital
cameras, and the Apple Mac Mini for the O'Reilly Network. He previously
worked as a technology analyst for GTE/Verizon. He also served as the
contracted forum manager for the MSN.com (and later ZDNet) Telephony
Forum and Windows CE Forum. More recently, he has served as the
eGovernment team leader for the State of Hawaii. You can find his Mobile
Workforce and Lifestyle commentary at http://www.mobileviews.com/. You
can learn more about Eccentric Technology at
http://www.ogasawalrus.com/. You can reach Todd by email at
Hacks@OgasaWalrus.com.
Mark Pilgrim is an accessibility architect by day. By night, he is a
husband and father who lives in North Carolina with his wife, his son,
and his dog. Mark spends his copious free time sunbathing, skydiving,
and reading Immanuel Kant's Critique of Pure Reason in the original
Klingon. He can be found stirring up trouble at
http://diveintomark.org/.
Premshree Pillai is a geek working at Yahoo!. He loves Ruby, beer, and
classic rock. He blogs at http://www.livejournal.com/users/premshree.
Eric Ries is currently CTO of IMVU, a startup creating 3-D, avatarbased
instant messaging. Eric also serves, in a volunteer capacity, as CTO of
the Taproot Foundation. Previously, he was senior software engineer at
There and cofounder and CTO of Catalyst Recruiting. He is author of
several free software projects, most recently the peer-to-peer RPC
system Kenosis, and coauthor of several books, including The Black Art
of Java Game Programming and Mastering Java.
Alan Taylor has been a web developer for over 10 years and has worked
for Monster.com, MSNBC.com, and Amazon.com. He builds web projects (such
as Amazon Light; http://kokogiak.com/amazon) and web hacks/toys on an
irregular basis, most of which can be found at http://kokogiak.com/.
Alan believes that open APIs are your friends and are positively the
best trend on the Internet in years.
Acknowledgments
To my wife, Shawnde, thanks for the continuous feedback and frontline
editing, and for cheerfully discussing Yahoo! during breakfast, lunch,
dinner, and every spare moment in between.
Many thanks go to Brian Sawyer for providing direction and encouragement,
and for fine-tuning the text.
Thanks to tech editor Steve Champeon for testing code, double-checking
facts, and adding important points to the technical details.
Thanks to Morbus Iff for taking my Perl to task and simplifying the
confusing bits.
Finally, thanks to everyone at Yahoo! who contributed tips and hack ideas,
including Vijay Anisetti, Stig Sæther Bakken, Dave Brown, Aurora Casanova,
David Dueblin, Jennifer Dulski, Marcus Foster, David Hall, Jason B.
Silverstein, Jeremy Zawodny, and many anonymous Yahoos. Thanks also to
Chris Kalaboukis and Bernard Mangold at Yahoo! Research for lending a
hand.
Preface
Yahoo! is an impressive example of what can happen when a hobby takes on a
life of its own. In 1994, Jerry Yang and David Filo began publishing a
personal list of sites they found interesting on the emerging World Wide
Web. As "Jerry's Guide to the World Wide Web" grew larger, the two
Stanford grad students began organizing the sites into categories, and the
basic structure of today's Yahoo! Directory was born. By late 1994, they
chose to rename their directory after the word yahoo because its original
definition describing a crude, rude person appealed to the pair's
subversive natures. (And as true computer geeks, they turned Yahoo! into
an acronym for Yet Another Hierarchical Officious Oracle.) Figure P-1 is a
look at the Yahoo! home page from December 1994.
Yahoo! looks very different today. Figure P-2 shows the more familiar
Yahoo! home page of 2005.
Though the two Yahoo! home pages look radically different, the original
idea of taming the chaos of the World Wide Web and making it accessible to
a wider audience remains. According to their vision statement, Yahoo!
wants "to enable people to find, use, share, and expand all human
knowledge." The goal of furthering this vision, nicknamed FUSE (for "find,
use, share, and expand"), can be found in every acquisition Yahoo! makes
and every product Yahoo! releases. Yahoo! has localized versions of its
offerings in dozens of countries, and the Yahoo! brand is recognized
around the world. Over the past 10 years, Yahoo! has become much more than
a guide to the Web; Yahoo! is a platform for visualizing and connecting
with the world.
Many Yahoo! features are familiar to anyone who uses the Web. Millions of
people use Yahoo! Search to find information on the Web. Millions more use
Yahoo! Groups to share information and collaborate on projects. And still
more use Yahoo! Mail every day to stay in touch with friends, family, and
coworkers. And Yahoo! is continually adding products and features to
realize its vision.
Figure I-1. Yahoo! in 1994
Over the past year, the FUSE philosophy has been a distinct feature of
Yahoo!'s newest services. In February 2005, Yahoo! launched Yahoo! Web
Services, allowing outside developers to use, share, and expand Yahoo!
features. In March 2005, Yahoo! launched Yahoo! 360, a way for people to
share thoughts and information with friends and family, while expanding a
network of friends. In April 2005, Yahoo! introduced My Web, a way to save
and share search results while creating your own personal categorized
directory of the Web.
This book aims to help you FUSE Yahoo! features and services by
introducing you to little-known corners of Yahoo!, by reintroducing you to
familiar Yahoo! services, and by showing you examples of the many ways
people are expanding Yahoo! on their own. Though the hacks might be crude
and rude at times, they're written in the same spirit of sharing something
interesting that inspired the creation of Yahoo! in the first place.
Figure I-2. Yahoo! in 2005
Why Yahoo! Hacks?
The term hacking has a bad reputation in the press. They use it to refer
to someone who breaks into systems or wreaks havoc with computers as their
weapon. Among people who write code, though, the term hack refers to a
quick-and-dirty solution to a problem, or a clever way to get something
done. And the term hacker is taken very much as a compliment, referring to
someone as being creative, having the technical chops to get things done.
The Hacks series is an attempt to reclaim the word, document the good ways
people are hacking, and pass the hacker ethic of creative participation on
to the uninitiated. Seeing how others approach systems and problems is
often the quickest way to learn about a new technology.
While Yahoo! itself has been around for over 10 years, it is releasing new
applications, web sites, and software at a blinding pace. This book isn't
intended to catalog everything Yahoo! offers, but rather to introduce new
technologies, such as Yahoo! Web Services, while showing novel ways to use
perennial offerings like Yahoo! Search, Yahoo! Mail, and Yahoo! Groups.
Through the years, developers have scraped, poked, and prodded every
corner of Yahoo! for their own uses, and the release of Yahoo! Web
Services is like a welcome mat being put out for a wider audience of
would-be hackers. This book intends to show you what's possible when you
view Yahoo! as a platform and inspire your inner hacker to take a new look
at Yahoo!.
How to Use This Book
You can read this book from cover to cover if you like, but each hack
stands on its own, so feel free to browse and jump to the different
sections that interest you most. If there's a prerequisite you need to
know about, a cross-reference will guide you to the right hack.
How to Run the Hacks
The programmatic hacks in this book run either on the command line (that's
Terminal for Mac OS X folk, DOS command window for Windows users) or as
CGI (that's "common gateway interface") scriptsdynamic pages living on
your web site, accessed through your web browser.
Command-Line Scripts
Running a hack on the command line invariably involves the following
steps:
Type the program into a garden-variety text editor: Notepad on Windows,
TextEdit on Mac OS X, vi or Emacs on Unix/Linux, or anything else of the
sort. Save the file as directedusually as scriptname.pl (the pl bit
stands for Perl, the predominant programming language used in Yahoo!
Hacks).
Alternately, you can download the code for all of the hacks online at
http://www.oreilly.com/catalog/yahoohks, where there is a ZIP archive
containing individual scripts saved as text files.
Get to the command line on your computer or remote server. In Mac OS X,
launch the Terminal (Applications Utilities Terminal). In Windows, click
the Start button, select Run…, type command, and hit the Enter/Return
key on your keyboard. In Unix…well, we'll just assume you know how to
get to the command line.
Navigate to where you saved the script at hand. This varies from
operating system to operating system, but usually involves something
like cd~/Desktop (that's your Desktop on the Mac).
Invoke the script by running the programming language's interpreter
(e.g., Perl) and feeding it the script (e.g., scriptname.pl) like so:
$ perl scriptname.pl
Most often, you'll also need to pass along some parametersyour search
query, the number of results you'd like, and so forth. Simply drop them
in after the script name, enclosing them in quotes if they're more than
one word or if they include an odd character or three:
$ perl scriptname.pl '"much ado about nothing" script' 10
The results of your script are almost always sent straight back to the
command-line window in which you're working, like so:
$ perl scriptname.pl '"much ado about nothing" script' 10
1. "Amazon.com: Books: Much Ado About Nothing: Screenplay…" [http://
www.amazon.com/exec/obidos/tg/detail/-/0393311112?v=glance]
2. "Much Ado About Nothing Script" [http://www.signal42.com/much_ado_
about_nothing_script.asp]
…
The elllpsis (…) bit signifies that we've cut off the output
for brevity's sake.
To stop output scrolling off your screen faster than you can read it, on
most systems you can pipe (read: redirect) the output to a little
program called more:
$ perl scriptname.pl | more
Hit the Enter/Return key on your keyboard to scroll through line by
line, or the space bar to leap through page by page.
You'll also sometimes want to direct output to a file for safekeeping,
importing into your spreadsheet application, or displaying on your web
site. This is as easy as:
$ perl scriptname.pl > output_filename.txt
And to pour some input into your script from a file, simply do the
opposite:
$ perl scriptname.pl < input_filename.txt
Don't worry if you can't remember all of this; each command-line hack has
a "Running the Hack" section that shows you just how it's done.
CGI Scripts
CGI scriptsprograms that run on your web site and produce pages
dynamicallyare a little more complicated if you're not used to them. While
fundamentally they're the same sorts of scripts as those run on the
command line, they are more troublesome because setups vary so widely. You
might be running your own server, your web site might be hosted on an
Internet service provider's (ISP's) server, your content might live on a
corporate intranet serveror anything in between.
Since going through every possibility is beyond the scope of this (or any)
book, you should check your ISP's knowledge base, or call the ISP's
technical support department, or ask your local system administrator for
help.
Generally, though, the methodology is the same:
Type the program in to a garden-variety text editor: Notepad on Windows,
TextEdit on Mac OS X, vi or Emacs on Unix/Linux, or anything else of the
sort. Save the file as directedusually as scriptname.cgi (the cgi bit
reveals that you're dealing with a CGI script).
Alternately, you can download the code for all of the hacks online at
http://www.oreilly.com/catalog/yahoohks, where there is a ZIP archive
containing individual scripts saved as text files.
Move the script over to wherever your web site lives. You should have
some directory on a server somewhere in which all of your web pages (all
those .html files) and images (ending in .jpg, .gif, etc.) live. Within
this directory, you'll probably see something called a cgi-bin
directory: this is where a CGI script must usually live in order for the
server to run the script (rather than just displaying the script's text
in your web browser) when you visit its URL.
You usually need to "bless" CGI scripts as executableto be run rather
than displayed. Just how you do this depends on the operating system of
your server. If you're on a Unix/Linux or Mac OS X system, this usually
entails typing the following on the command line:
$ chmod 755 scriptname.cgi
Now you should be able to point your web browser at the script and have
it run as expected, behaving in a manner similar to that described in
the "Running the Hack" section of the hack at hand.
Just what URL you use, once again, varies widely. It should, however,
look something like http://www.your_domain.com/cgi-bin/scriptname.cgi,
where your_domain.com is your web site domain, cgi-bin refers to the
directory in which your CGI scripts live, and scriptname.cgi is the
script itself.
If you don't have your own domain and are hosted at an ISP, the URL is
more likely to look like
http://www.your_isp.com/~your_username/cgi-bin/scriptname.cgi, where
your_isp.com is your ISP's domain, ~your_username is your username at
the ISP, cgi-bin refers to the directory in which your CGI scripts live,
and scriptname.cgi is the script itself.
If you come up with something called an "internal server error" or see the
error code 500, something's gone wrong somewhere in the process. At this
point you can take a crack at debugging (read: shaking the bugs out)
yourself or ask your ISP or system administrator for help.
Debuggingespecially CGI debuggingcan be a little more than the average
newbie can bear, but there is help in the form of a famous frequently
asked question (FAQ) archive: "The Idiot's Guide to Solving Perl CGI
Problems." Search for it and step through as directed.
Learning to Code
Fancy trying your hand at a spot of programming? O'Reilly's best-selling
Learning Perl (http://www.oreilly.com/catalog/lperl3), by Randal L.
Schwartz and Tom Phoenix, provides a good start. Apply what you learn to
understanding and using the hacks in this book, perhaps even taking on the
"Hacking the Hack" sections to tweak and fiddle with the scripts. This is
a useful way to get a little programming under your belt if you're a
searching nut, since it's always a little easier to learn how to program
when you have a task to accomplish and existing code to leaf through.
How This Book Is Organized
The book is divided into several chapters, organized by subject:
Chapter 1, Search
This chapter shows you how to become a Yahoo! power searcher by taking
advantage of meta keywords to return more relevant results. You'll also
see how to use search shortcuts to find instant answers to some common
questions. This chapter tells you how to find popular search phrases and
technologies by analyzing Yahoo! Buzz, and we'll pit Yahoo! against Google
to see which search engine returns the most relevant results.
Chapter 2, Services
Yahoo! offers information about everything from stocks and bonds to movie
and TV schedules. This chapter shows some unique ways to use Yahoo! Web
Services, including monitoring your commute for problems, watching TV
schedules automatically for appearances by your favorite celebrities, and
visualizing your music collection.
Chapter 3, Communicating
Use the hacks in this chapter to reach out and touch someone. You'll find
hacks for managing your Yahoo! Mail, collaborating with Yahoo! Groups, and
exploring your social networks with Yahoo! 360. This chapter also shows
some ways to personalize Yahoo! Messenger and share your photos with the
world.
Chapter 4, Web Services
This chapter introduces you to the back door that Yahoo! has opened for
developers. You'll find bare-bones examples in several scripting languages
that can give you a head start to creating your own Yahoo!-powered
applications.
Chapter 5, Applications
See how people are using Yahoo! data in their own applications and have a
bit of fun in the process. Find out how to randomize your desktop
background with images from across the Web and how to integrate Yahoo!
with Excel and Outlook.
Chapter 6, Webmastering
If you publish on the Web, you're well aware of the traffic Yahoo! can
send to your site. This chapter shows how to get listed and introduces you
to other Yahoo! components you can plug into your site.
Conventions Used in This Book
The following is a list of the typographical conventions used in this
book:
Italics
Used to indicate URLs, filenames, filename extensions, and directory
names. For example, a path in the filesystem will appear as
/Developer/Applications.
Constant width
Used to show code examples, the contents of files, and console output, as
well as the names of variables, commands, and other code excerpts.
Constant width bold
Used to highlight portions of code, typically new additions to old code.
Also used to show text you should type literally at a command-line prompt.
Constant width italic
Used in code examples and other excerpts to show sample text to be
replaced with your own values.
Gray type
Used to indicate a cross-reference within the text.
A carriage return () at the end of a line of code is used to denote an
unnatural line break; that is, you should not enter these as two lines of
code, but as one continuous line. Multiple lines are used in these cases
due to page-width constraints.
You should pay special attention to notes set apart from the text with the
following icons:
This is a tip, suggestion, or general note. It contains useful
supplementary information about the topic at hand.
This is a warning or note of caution, often indicating that
your money or your privacy might be at risk.
The thermometer icons, found next to each hack, indicate the relative
complexity of the hack:
beginner moderate expert
Using Code Examples
This book is here to help you get your job done. In general, you may use
the code in this book in your programs and documentation. You do not need
to contact us for permission unless you're reproducing a significant
portion of the code. For example, writing a program that uses several
chunks of code from this book does not require permission. Selling or
distributing a CD-ROM of examples from O'Reilly books does require
permission. Answering a question by citing this book and quoting example
code does not require permission. Incorporating a significant amount of
example code from this book into your product's documentation does require
permission.
We appreciate, but do not require, attribution. An attribution usually
includes the title, author, publisher, and ISBN. For example: "Yahoo!
Hacks by Paul Bausch. Copyright 2006 O'Reilly Media, Inc., 0-596-00945-3."
If you feel your use of code examples falls outside fair use or the
permission given above, feel free to contact us at
permissions@oreilly.com.
Safari Enabled
When you see a Safari® Enabled icon on the cover of your favorite
technology book, that means the book is available online through the
O'Reilly Network Safari Bookshelf.
Safari offers a solution that's better than e-books. It's a virtual
library that lets you easily search thousands of top tech books, cut and
paste code samples, download chapters, and find quick answers when you
need the most accurate, current information. Try it for free at
http://safari.oreilly.com/.
How to Contact Us
We have tested and verified the information in this book to the best of
our ability, but you may find that features have changed (or even that we
have made mistakes!). As a reader of this book, you can help us to improve
future editions by sending us your feedback. Please let us know about any
errors, inaccuracies, bugs, misleading or confusing statements, and typos
that you find anywhere in this book.
Please also let us know what we can do to make this book more useful to
you. We take your comments seriously and will try to incorporate
reasonable suggestions into future editions. You can write to us at:
O'Reilly Media, Inc.1005 Gravenstein Hwy N.Sebastopol, CA 95472(800)
998-9938 (in the U.S. or Canada)(707) 829-0515 (international/local)(707)
829-0104 (fax)
To ask technical questions or to comment on the book, send email to:
bookquestions@oreilly.com
The web site for Yahoo! Hacks lists examples, errata, and plans for future
editions. You can find this page at:
http://www.oreilly.com/catalog/yahoohks
For more information about this book and others, see the O'Reilly web
site:
http://www.oreilly.com/
Got a Hack?
To explore Hacks books online or to contribute a hack for future titles,
visit:
http://hacks.oreilly.com/
Chapter 1. Search
Section 1.1. Hacks 122: Introduction
Hack 1. Fine-Tune Yahoo! Web Search Queries
Hack 2. Save Time with Search Shortcuts
Hack 3. Create a Yahoo! ID
Hack 4. Set Persistent Yahoo! Search Preferences
Hack 5. Assemble Advanced Search Queries
Hack 6. Translate Any Page with Yahoo!
Hack 7. Personalize, Track, and Share the Web
Hack 8. Prefetch Yahoo! Search Results
Hack 9. Compare Yahoo! and Google Search Results
Hack 10. Find Content You Can Reuse Legally
Hack 11. Find Video from Across the Web
Hack 12. Streamline Browsing with the Yahoo! Toolbar
Hack 13. Customize the Firefox Quick Search Box
Hack 14. Spot Trends with Yahoo! Buzz
Hack 15. Find Hot Technologies at the Buzz Game
Hack 16. Tame Long Yahoo! URLs
Hack 17. Opt Out of Advertiser Cookies
Hack 18. Track News About Yahoo!
Hack 19. Spider the Yahoo! Catalog
Hack 20. Browse the Yahoo! Directory
Hack 21. Track Additions to Yahoo!
Hack 22. Yahoo! Directory Mindshare in Google
1.1. Hacks 122: Introduction
Many of us use search engines in the same way we we use street signs. We
use them to navigate, to get our bearings, and to pinpoint our
destination. We rarely stop to consider the signs themselves or look for
more information they might be telling us. As with street signs, we'd be
lost without search engines, and by taking a few minutes to contemplate
the Yahoo! Web Search results page, you might find new ways to reach your
destination.
Take a look at Figure 1-1, which shows a Yahoo! Web Search results page
for the query ancient greece.
Figure 1-1. Yahoo! Web Search results
You can see the familiar numbered listing of search results, but there are
a number of other bits of information on the page. Here's a look at what's
available on a Yahoo! Search results page:
Navigation bar
You'll find the gray navigation bar at the top of the page on many pages
at Yahoo! sites. The bar provides a consistent way to get to the main
Yahoo! page (http://www.yahoo.com/), the My Yahoo! portal [Hack #34], and
Yahoo! Mail [Hack #52]. The bar also indicates your login status by
displaying your Yahoo! ID [Hack #3] or Guest, along with links that let
you sign in to Yahoo! or sign out. You can also click the Help link at the
far right of the navigation bar to read documentation about the site.
Search links
Just above the search form, you'll find links to other Yahoo! searches,
including Images, Video [Hack #11], the Yahoo! Directory [Hack #20],
Yahoo! News [Hack #32], and Yahoo! Shopping [Hack #47]. You can click any
of these search links to search with the exact query you used at one of
the other Yahoo! Search properties so that you don't have to retype your
search term.
Result count
Search results are returned as a number of pages, and you'll find your
position within the results in the shaded blue bar. For instance, the
first page of results will be labeled as Results 110, the second page will
show Results 1120, and so on. (You can adjust the number of results per
page by setting your search preferences [Hack #4].) You'll also see the
estimated total number of results for your query.
Query definition links
Just to the right of the result count, you'll see the words in the query
as links. You can click the links to see dictionary definitions of the
words at Yahoo! Reference [Hack #40].
Search speed
The shaded blue bar will also show you how long it took to fetch the
results, usually less than a half-second.
Sponsor results
You'll find context-sensitive advertising along the right side of the page
and in a shaded blue box above or below the Yahoo! Web Search results.
Advertising is always clearly labeled Sponsor Results, and the type of ads
will be triggered by the topic you're searching for.
Search suggestions
Search phrases similar to the one you entered are labeled with Also Try:
at the top of the page. These suggestions show you what other Yahoo! users
are searching for related to your topic and can help you refine your
search. Yahoo! will display the top few suggestions, and if there are
several suggestions you can click the More or Show All links to see a
complete list of suggestions available.
Yahoo! shortcut info
If your query triggered a Yahoo! Shortcut [Hack #2], the shortcut info
will be shown above the Web results and marked with the Y! logo. Shortcuts
usually give you brief information about your query, with links to more
information at other Yahoo! properties.
Web results
The Web Search results show the familiar list of documents from across the
Web, which contain your query words or phrases. Each result is numbered
and includes the document title, a brief excerpt with query words in bold,
and the document location.
Results page
Below the Web Search results you can navigate between results pages by
clicking a page number or the Prev and Next links.
Each Yahoo! Web Search result represents a document somewhere on the Web.
The document will most likely be a web page written in HTML, but could be
in another format such as Adobe PDF, Microsoft Word, or plain text. Figure
1-2 shows a typical Yahoo! Web Search result with all of the associated
links and features.
Figure 1-2. A single Yahoo! Web Search result
A closer look at a Web Search result shows that there's more listed than
simply a document title and excerpt. Here's a look at what you'll find
with each result:
Document title
The document title is pulled from the document itself, either from HTML
document. Click the title to view the page or document.
New window link
To the right of the title is an icon showing two windows that you can
click to open the document in a new browser window. This option is handy
for keeping your search results in place while you read through pages of
the results in different windows.
Document excerpt
Just below the title, you'll find an excerpt of text from the document
with words or phrases from your query in bold. This helps you determine
the context of your search phrase and can tell you quickly whether the
document is relevant.
Category
If the document or page is listed in the Yahoo! Directory, you'll see the
category that page is listed in. You can click the category title to see
that category and view other sites that Yahoo! Editors have chosen to
include in the directory.
RSS
Many web publishers associate an RSS feed with their sites, which allows
readers to subscribe to site updates in programs called Newsreaders or at
sites such as My Yahoo! that pull content from other sources. When Yahoo!
detects the presence of a site feed, you'll find a link to view that feed
as raw XML or add the feed to My Yahoo! with a click.
URL
On the last line of the listing, you'll see the document URL in green with
any words from your query in bold. This tells you the domain the document
is hosted under, and you can tell from the top-level domain (.com, .edu,
.gov, etc.) whether the site is run by a business, a school, or the U.S.
government.
Size in bytes
Many results (such as those listed earlier in Figure 1-1) show the size of
the document in bytes, which can give you a rough idea of how long the
page will take to download. Web pages are usually fairly quick, but
Microsoft Word documents or Adobe PDF files might vary widely in size.
Cache
If Yahoo! has a copy of the document saved on its servers, you can click
the Cached link to view the copy. This is particularly useful if the site
isn't responding, as you can still get to an archived copy of the
information.
Other pages
The "More from this site" link will show you other pages at the domain
that match your query.
My Web links
Yahoo!'s My Web [Hack #7] lets you save sites that you want to remember,
or block sites that you never want to see in results again. You can use
the Save and Block links to add or remove documents.
Once you're aware of all the features of the Yahoo! Web Search results
page, you can make decisions about the best path to the information you're
after.
This chapter shows you how to take advantage of Yahoo! Web Search in a
number of different waysfrom using meta keywords for quick answers [Hack
#1] to viewing results in a radically different way [Hack #77].
Hack 1. Fine-Tune Yahoo! Web Search Queries
By understanding how to phrase your searches, you'll find more relevant
search results.
Using Yahoo! Web Search (http://search.yahoo.com/) is deceptively simple.
You can type in any word or phrase and find matches in documents across
the Web. The trade-off for this simplicity is having to look through
hundreds, thousands, or millions of results to find the documents that are
actually useful to you. By understanding how Yahoo! expects queries to be
phrased, you can limit the results to include only those documents most
relevant to yousaving you the time of looking through extraneous results.
1.2.1. Search Basics
To start building sophisticated queries, you need to know the basics. The
following search basics will help you refine your Yahoo! searches:
Keyword
By default, Yahoo! searches for all of the words you type into a search
form. If you type grammar into the search form, Yahoo! will return
documents that contain the word grammar. A search for grammar school will
return documents that contain both words somewhere within the document,
but not necessarily together.
Complete phrase
To search for words in a specific order, enclose the words in quotation
marks. A search for "grammar school" will return documents that contain
the complete phrase grammar school. You can combine keyword and phrase
searches. To find documents that contain the phrase grammar school and
also have the word Oregon somewhere in the document, you could search for
"grammar school" Oregon.
OR keyword
You can change the default behavior of keyword searches by using the
capitalized keyword OR between words. A search for grammar OR primary will
return documents that contain either grammar or primary, but not
necessarily both words.
Exclude words or phrases
To find documents without a certain word, you can use the minus sign (-)
along with the word you want to exclude. If a search for Oregon school
returns too many pages for schools in the city of Portland, you could type
Oregon school -Portland to exclude any pages with the word Portland from
the results.
Once you have the basics down, you can start mixing and matching, and
grouping queries together with parentheses. To find documents that contain
the word Oregon, and the phrase grammar school or the phrase elementary
school, you could type Oregon ("grammar school" OR "elementary school").
The parentheses are required to show where the OR should be used. Without
the parentheses, Yahoo! would look for documents that contain both the
word Oregon and the phrase grammar school, or documents that simply
contain the phrase elementary school. Because the word Oregon is necessary
across documents, the two secondary phrases need to be grouped into a
single unit with parentheses.
1.2.2. Search Meta Words
In addition to the basic operators, there are keywords that Yahoo! calls
Search Meta Words that you can use to refine your search:
site:
Use this keyword to limit search results to a single web site. You can
search for the word marsz across NASA sites by typing mars site:nasa.gov.
All of the results will be from sites hosted at the nasa.gov domain. You
also use this keyword to limit results to a single top-level domain, such
as .org, .com, or .edu. To find mentions of the word mars across academic
sites, type mars site:.edu.
hostname:
This keyword limits results to a specific host at a site. For example,
NASA's Mars Exploration Program has a web site at
http://mars.jpl.nasa.gov/. If you want to search this specific section of
the nasa.gov domain for the word rover, you could type rover
hostname:mars.jpl.nasa.gov.
link:
You can use this keyword to find sites that link to a specific URL. This
keyword works well if you want to judge the popularity of a specific page
by finding the number of other sites linking to a particular page. You'll
need to include the full URL, so to find pages that link to the Amazon
Hacks page at the O'Reilly Hacks site, type
link:http://www.oreilly.com/catalog/amazonhks/.
linkdomain:
Instead of a specific page, this keyword looks for any links to a specific
domain. If you're interested in pages that link to
http://www.oreilly.com/, type linkdomain:oreilly.com.
url:
This keyword lets you look up a single page at Yahoo! by specifying the
URL. You can look up the O'Reilly Hacks home page by typing
url:http://hacks.oreilly.com/. You could use this keyword to see how pages
at a site are displayed in Yahoo!'s Web, Images, and Video Search results.
inurl:
Use this keyword to find sites that have a specific word within the URL.
To find all sites that have the word mars in the URL, type inurl:mars.
intitle:
Like inurl:, this keyword returns documents that have a specific word in
the document title. To find documents with mars in the title, use
intitle:mars.
You can also use the basic search operators in combination with the Search
Meta Words to refine your search. Say you'd like to search for the word
mars across documents, but you don't want pages from any nasa.gov site;
type mars -site:nasa.gov. Because Yahoo! supports very long queries, you
could specify a whole list of sites that you don't want information from:
mars -site:nasa.gov -site:mars.com -site:space.com. But to search those
sites exclusively, take away the minus symbol, group the site list
together with parentheses, and use the OR keyword like this: mars
(site:nasa.gov OR site:mars.com OR site:space.com). Again, note that the
use of the OR keyword requires the use of parentheses.
Some of these query combinations can also be accomplished with the
advanced search form [Hack #5] available at
http://search.yahoo.com/web/advanced.
Hack 2. Save Time with Search Shortcuts
By using a few specific keywords, you can have Yahoo! answer common
questions within your search results, provide specific information, or
point directly to your answer.
At its most basic, Yahoo! Search allows you to type in search terms, click
the Search button, and receive documents that include that word or phrase
from across the Web. This makes Yahoo! a keyword search engine, and
knowing this can help you put together your queries.
Yahoo! Search accepts a number of key phrases that can provide quick
answers to common questions. To illustrate, here's an example in which
search shortcuts can give you a faster answer than keywords alone.
Imagine you're in California and you'd like to call a friend in London,
England. You can't remember the time difference and you don't want to call
at 3 a.m. London time, so you turn to Yahoo! for help. Browsing to
http://search.yahoo.com/, you find yourself in front of the search form,
about to type. What's the best query? If you were asking a human being for
the answer you might be tempted to type in a complete question: what is
the time in London?.
Because Yahoo! Search looks for matching words or phrases, you've told
Yahoo! to find documents that include the words in your phrase. So the top
results will likely be the web site for the London newspaper The Times and
other documents that contain the search terms London and time. You'll
probably find your answer at sites that are in the results, but there's a
much faster way to tell Yahoo! Search exactly what you're looking for.
Understanding the time zone and other search shortcuts will give you quick
answers to some common questions.
1.3.1. Yahoo! Search Shortcuts
When Yahoo! Search encounters a key phrase, Yahoo! tries to provide a
direct answer, in addition to matching documents that include the terms in
the phrase. For example, if you want to know the current time in London,
you can type time in London and you'll find the current time in London
above the search results, as shown in Figure 1-3.
Figure 1-3. An answer using a Yahoo! Search shortcut
By using this shortcut, you'll have the answer without looking through the
results or visiting other sites. Replace London with any city or with a
city-and-state combination, and you'll never have to worry about
calculating time zone differences again.
You'll know you've used a Yahoo! shortcut when you see a result at the top
marked with the Yahoo! Y!, as shown in Figure 1-3. You can browse a
complete, updated list of Yahoo! Search shortcuts at
http://tools.search.yahoo.com/shortcuts/. Here are a few of the shortcuts
available:
Definitions
Type define word, and Yahoo! will provide a brief dictionary definition
for the word and a link to the full dictionary entry for that word at
Yahoo! Reference [Hack #40].
Encyclopedia entries
Search for word facts, and Yahoo! will display an excerpt of the Columbia
Encyclopedia entry for that word and a link to the full entry.
Airport information
Yahoo! provides quick links to maps, flight information, and local weather
if you type airport code airport. For example, the shortcut for San
Francisco International Airport is SFO airport.
Hotels
Type city hotels to get a quick list of hotels in that city, along with
the Yahoo! Local rating, the base rate, and a link to check availability.
You can also look for a specific hotel chain by typing city chainfor
example, San Francisco Ramada.
Stock quotes
Type quote stock symbol to get the current trading price for a stock
(delayed 15 minutes). You can keep tabs on Yahoo! by typing quote yhoo.
Sports scores
Find out how your favorite pro team is doing by typing team-mascot scores.
You'll get a quick look at recent games, and sometimes you can see who
they're playing in the next game. The query 49ers scores will give you
information about the San Francisco 49ers football team.
Movie showtimes
To see when movies are playing in your area, type showtimes Zip Code and
you'll get links to local theater showtimes and a few showtimes for
current movies.
Zip Codes
You can find all of the Zip Codes for a city by typing zip code city.
Area codes
If you're not sure where someone is calling from, try typing the
three-digit area code into Yahoo! Search. Yahoo! will return a list of
cities in that area code.
Weather
For a quick look at the current weather for any city, type city weather.
Yahoo! will give you the current conditions and the expected high and low
temperatures.
Once you learn how to speak the Yahoo! Search shortcut language, you'll
save time answering some basic questions.
1.3.2. Yahoo! Properties Shortcuts
Another set of shortcuts available via Yahoo! Search forms are shortcuts
to Yahoo! properties. Say you want to get to Yahoo! Movies but can't
remember the URL. You can simply type movies! into any search form, and
you'll automatically be redirected to Yahoo! Movies
(http://movies.yahoo.com/).
The exclamation point at the end lets Yahoo! know you're looking for a
Yahoo! property.
There are hundreds of Yahoo! properties, and most of the shortcuts are
intuitive. Here's a list of a few Yahoo! properties, along with their URLs
and shortcuts:
Table 1-1.
Property
URL
Shortcut
Yahoo! Mail
http://mail.yahoo.com/
mail!
Yahoo! Games
http://games.yahoo.com/
games!
Yahoo! News
http://news.yahoo.com/
news!
Yahoo! Sports
http://sports.yahoo.com/
sports!
Yahoo! Finance
http://finance.yahoo.com/
finance!
Yahoo! Address Book
http://address.yahoo.com/
address!
Yahoo! Calendar
http://calendar.yahoo.com/
calendar!
Yahoo! Education
http://education.yahoo.com/
education!
Yahoo! Next
http://next.yahoo.com/
next!
Keep in mind that you can use these Yahoo! properties shortcuts from any
Yahoo! Search form, including the Yahoo! Toolbar form and the Firefox
quick search box.
Hack 3. Create a Yahoo! ID
The key to many of the services at Yahoo! is a unique Yahoo! ID, and
understanding how IDs work is key to keeping your Yahoo! ID private.
A Yahoo! ID is what distinguishes you from the crowd and what lets Yahoo!
remember you across browsing sessions and across computers. If you've been
using the Web for any amount of time, chances are good that you already
have a Yahoo! ID. In November 2004, Nielsen/Netratings estimated that 55
million people around the world use Yahoo! Mail, and all of them sign in
with a Yahoo! ID.
1.4.1. Signing Up
If you don't already have a Yahoo! ID, you can create one in less than
five minutes. Browse to http://login.yahoo.com/ and click Sign Up Now for
the new account form.
The most important decision to make as you fill out the new account form
is what your Yahoo! ID will be. You'll use your ID anytime you want to
access your personalized Yahoo! data, and your ID will determine what your
Yahoo! Mail email address will be. If your Yahoo! ID is j0d00d, your email
address is j0d00d@yahoo.com. The hardest part is finding an ID that is
different from the 55 million Yahoo! IDs that already exist. The next
hardest part is keeping the ID short and memorable. Keep in mind that
you'll use this ID anytime you want to log in to Yahoo!. A short ID will
save your fingers some work if you plan to log in to Yahoo! from your cell
phone. And friends might want to contact you with Yahoo! Instant Messenger
via your Yahoo! ID, so a short ID that is similar to your name will help
them remember it.
Before filling out the form, go straight to the Yahoo! ID field and start
trying potential IDs. Click the Check Availability of This ID button until
you find something that's not taken. If you can get something with your
initials or first and last name, consider yourself lucky.
When it's time to choose your password, it's tempting to recycle a
password that you use in other places. Your Yahoo! ID and password is the
only thing protecting your email from unauthorized readers, so it's a good
idea to make the password unique and somewhat complex. Yahoo! requires at
least six characters, but you can do better than that. A complex password
should include upper-and lowercase letters, as well as symbols or numbers.
A good trick for creating long, memorable passwords that are hard for
hackers to guess is to think of the first line of your favorite poem or
song and choose the first letter of each word as your password. So "Mary
had a little lamb, its fleece was white as snow" would translate into the
password Mhallifwwas. Add a memorable number, such as the year you were
born, to the end and you'll have something like Mhallifwwas1973, which
looks completely random but has meaning for you.
If you find yourself keeping track of several dozen unique
passwords, you might want to consider using a password manager
to store them securely in one place. You can download the
freely available Password Safe program for Windows at
http://passwordsafe.sourceforge.net/just be sure not to forget
the master password! Mac and Linux users may want to try
Password Gorilla, available at
http://www.fpx.de/fp/Software/Gorilla/.
If you ever forget your Yahoo! password, you can always reset it later, in
a couple of different ways. If you provide an alternate email address
during this process, you'll be able to verify that address and have the
ability to reset your password at any time. But if you want a bit more
anonymity and don't want to provide an alternate email, be sure to
remember the answer you give to the security question when you sign up.
Your answer will be your only key to recovering your password and any
information associated with your account if you ever forget your password.
As you're finishing up the registration process, you'll notice an image
with wavy numbers and letters, like the one in Figure 1-4.
Figure 1-4. Yahoo! Registration captcha equal to "6z3e"
The image is called a captcha, and Yahoo! uses them to keep spammers from
automatically creating Yahoo! accounts. If you can discern the numbers and
letters in the graphic, you will prove to Yahoo! that you are a human
rather than an automated program. The captcha can be difficult to read
sometimes, and if you can't make out the letters and numbers, it doesn't
mean you're not a human. Simply reload the page to get a differentand
hopefully more readablecaptcha.
1.4.2. Signing In
If you just created your account, you'll be logged in and ready to use any
of Yahoo!'s applications. But from time to time, you'll need to sign in.
Again, your Yahoo! ID and password are your keys to security, so you
should do what you can to protect these. Before you log in, you can
protect this information by switching to a secure connection, as follows.
Underneath the login form, you'll find a text link labeled MODE:, which
you can use to switch to a secure connection. Clicking the link, you'll
find that the URL in the address bar begins with https: instead of the
standard http: and you'll see a padlock icon in the lower status bar, as
shown in Figure 1-5.
Firefox users will have the added indication of a yellow
address bar when browsing a secure page.
The default login form uses a standard connection, and making this small
switch to the secure SSL connection will ensure that your Yahoo! ID and
password combination are hidden from prying eyes. But it's important to
note that the rest of your Yahoo! activities will not be encrypted, even
if you log in securely. Yahoo! uses a standard connection for most of its
services, including email. If you're ever wondering whether the current
page you're visiting is secure, check for the padlock icon in the
lower-right corner of your browser.
Figure 1-5. Yahoo! secure login page
Checking the "Remember my ID on this computer" box sets a cookie in your
browser that lets Yahoo! remember your ID between browsing sessions. Even
with this option checked, Yahoo! will occasionally ask you to verify your
password, so keep it handy if you don't have your password memorized. If
you change your mind and no longer want Yahoo! to remember your ID on your
computer, you can simply sign out.
1.4.3. Signing Out
At the top of most pages at Yahoo!, you'll find a welcome message that
includes your Yahoo! ID, as shown in Figure 1-6.
Figure 1-6. Welcome message with Sign Out link
Under your ID, you'll find a Sign Out link that you can click anytime to
sign out of Yahoo! If you share your computer with others or visit Yahoo!
from a public computer, it's always a good idea to sign out when you're
done using Yahoo!. Signing out will help ensure that your personal
dataeverything from financial information to private emailstays personal.
1.4.4. Removing Your Account
If you ever want to part ways with Yahoo!, you can visit
https://edit.yahoo.com/config/delete_user to remove your account
completely. You'll permanently lose access to any personal data you may
have assembled (such as email) and any personal preferences (such as news
sources at My Yahoo!). Weigh this option carefully before proceeding,
because it's a permanent change, and you won't be able to recover your
unique Yahoo! ID in the future. You'll need to enter your password a final
time on this page and then click "Terminate this account."
Hack 4. Set Persistent Yahoo! Search Preferences
Tweak your Yahoo! preferences to get the most out of your searching.
If you already have a Yahoo! ID, you can set some preferences that will
affect the appearance and content of your Yahoo! searches. To set your
preferences, first make sure you're logged in to Yahoo! by visiting
http://login.yahoo.com/ and entering your Yahoo! ID and password. From
there, browse to http://www.yahoo.com/ or http://search.yahoo.com/ and
look for the Preferences link to the right of the search form, like the
one highlighted in Figure 1-7.
Figure 1-7. Yahoo! Search Preferences link
If you don't see the preferences link, you can browse directly to
http://search.yahoo.com/preferences. From the Preferences page, you can
set a number of options that Yahoo! will remember and apply to any search
results in the future.
1.5.1. New Window
When searching a particular topic, it's easy to click on a search result,
get lost in reading, and find yourself several clicks away from your
original page of search results. If you find yourself clicking your
browser's Back button again and again to get back to your Yahoo! search
results, you might want to open links from the search results page in a
new browser window. You can set this preference by checking the New Window
box on the Preferences page. This is handy for keeping your search results
page in place, allowing you to browse other sites without fear of losing
your search results.
1.5.2. Number of Results
By default, Yahoo! shows 20 results on each page. You can change this
setting on the Preferences page to 10, 15, 20, 30, 40, or 100 results.
Setting it to display fewer results per page will keep your scrolling to a
minimum, but if you have a large screen you might appreciate seeing up to
a hundred results without clicking through several pages.
1.5.3. Adult Content Filtering
As in other media, the Web is filled with material that isn't appropriate
for children or the workplace. Yahoo! indexes the entire Webincluding the
seamier sectionsand Yahoo!'s answer to this dilemma is the SafeSearch
Filter. With SafeSearch enabled, Yahoo! will do its best to exclude any
adult material from search results. There are three different settings you
can apply to your Yahoo! ID:
Filter out adult Web, video, and image search results
This enables SafeSearch across every type of Yahoo! Search that has adult
content.
Filter out adult video and image search results only
This enables SafeSearch for video and image searches at Yahoo!, but Web
searches might still contain adult material.
Do not filter results
This setting completely disables SafeSearch, and adult material will be
included in Yahoo! Search results.
The default setting is "Filter video and image search," so even if you
never visit your Yahoo! Preferences page, SafeSearch is working behind the
scenes.
In addition to choosing a filter level, you can lock a SafeSearch setting
for a specific browser. When you check the SafeSearch Lock checkbox and
update your preferences, Yahoo! sets a cookie for your browser that will
keep your SafeSearch setting for every Yahoo! ID that uses that browser.
If you have children in the house and they share your web browser, this is
a way to keep adult material from them.
Because the SafeSearch Lock is tied to a particular browser rather than a
particular Yahoo! ID, it functions a bit differently from the other
settings. If another user logs in with a different Yahoo! ID using the
same browser, she'll be able to change the SafeSearch Lock setting.
However, if the particular Yahoo! ID has an age set and the user is listed
as under 18, the SafeSearch Lock option will be hidden from view.
1.5.4. Language
Yahoo! keeps track of files and web pages on servers across the world and
notes the language of each page in its index. You can specify that you'd
like to receive results in all, one, or a custom combination of the many
available languages. You've probably stumbled across pages in a language
you don't understand before, and you can save some time by excluding these
from your search results. Figure 1-8 shows the current list of languages
that Yahoo! lets you choose from, and you can select one or more from the
list.
Figure 1-8. The list of languages at Yahoo!
By default, Yahoo! displays results in any language. Of course, English
search terms generally return web pages in English, but without setting
this preference, you'll probably run into pages in other languages from
time to time. For example, my last name is a common German last name, so a
search for "Paul Bausch" yields both English and German pages.
Hack 5. Assemble Advanced Search Queries
By understanding how Yahoo! Advanced Search URLs are structured, you can
create your own Advanced Search queries on the fly.
In addition to the simple search form you'll find at
http://search.yahoo.com/, Yahoo! offers an Advanced Web Search form at
http://search.yahoo.com/web/advanced. This form lets you refine your
search in a number of ways, so you can narrow the results to a more useful
list.
For example, if you'd like to find information about a generic topic, such
as astronomy, you could go to Yahoo!, type astronomy into the search form,
and find hundreds of sites related to the word. But if you want only a
segment of those results, you can browse over to the Advanced Web Search
form, type astronomy, and limit the results by top-level domain, as shown
in Figure 1-9.
Figure 1-9. Yahoo! Advanced Search form
A search for astronomy across .gov sites returns only pages at NASA's web
site. The same search limited to .edu sites results in astronomy programs
at various universities, and limiting to .com gives you astronomy
magazines at the top of the results.
You can further refine your search by limiting it to a specific file
format, such as PDF files, Excel spreadsheets, or XML files. For any given
search, you can also override your global preferences settings for
language, number of results, and adult content filtering.
1.6.1. Anatomy of an Advanced Search URL
To get started with hacking URLs, type a term into the Advanced Web Search
form and click the Yahoo! Search button, which will take you to the
results page. Once there, note the insanely long URL in the address of
your browser. It will look something like this:
http://search.yahoo.com/search?_adv_prop=web&x=op&ei=UTF-8&va=astronomy&va_
vt=any& vp_vt=any&
vo_vt=any&ve_vt=any&vd=all&vst=.gov&vs=.gov&vf=all&vm=p&
fl=0&n=20
For any given search URL, some of the variables you'll find in the URL are
redundant or not necessary. The web form basically acts as a URL-building
tool that has assembled this URL for you, and it isn't picky about which
variables it includes. By understanding the pieces of the URL, you can
construct your own queries using shorter URLs without the form.
Note that the domain is followed by /search?, followed by a series of
variable/ value pairs separated by ampersands. Not all of these variables
will affect the search results, but there are some that are useful to play
with. The variables are a bit cryptic (to keep the URLs as short as
possible), so here's a list of the relevant variables and what they
represent.
The v* variables represent the way you'd like Yahoo! to handle the phrase.
You can choose from the following variables:
Table 1-2.
va
Use this variable when you're looking for all of the words in a
particular query. A query with the value astronomy magazine finds
pages that contain both astronomy and magazine.
vp
This variable holds the search query when you want to match a
specific phrase, so a query with the value astronomy magazine finds
pages that contain the exact phrase astronomy magazine.
vo
This variable indicates a search for any of the words in a
particular query. So a query with the value astronomy magazine
returns documents that contain either astronomy or magazine.
ve
This variable indicates words that should not appear in any of the
pages, and it must be used with one of the other variables. For
example, combining one of the above queries with ve=NASA allows you
to search for astronomy magazine on pages that don't include the
term NASA.
Another group of similarly patterned variables lets you limit searching to
a specific part of a document, such as the title or URL. The format for
these variables is v*_vt, where the asterisk is replaced by the type of
primary search query. The possible values include any, title,or url. For
example, if you'd like to search for pages that have the exact phrase
astronomy magazine in the title, use the vp and vp_vt variables together,
like so:
search?vp=astronomy+magazine&vp_vt=title
If you'd like to limit your results to pages that have been updated
recently, you can use the vd variable. You can get all results, which is
the default, or limit them to pages updated within the last three months,
six months, or year. The respective values for these are all, m3, m6,or y.
So finding all documents that contain the phrase astronomy magazine that
have been updated within the last three months looks like this:
search?vp=astronomy+magazine&vp_vt=any&vd=m3
The vs variable is useful for limiting searches to a top-level domain,
such as .com. In addition to top-level searches, you can narrow things to
a specific web site. If you want to find every mention of astronomy
magazine at the specific web site http://www.cnn.com/, you could use the
variable like this:
search?vp=astronomy+magazine&vp_vt=any&vs=cnn.com
The vf variable limits searches to a specific file type. Yahoo! supports a
set number of file types, and here are the current values you can use with
this variable:
all
The default value; returns any type of document
html
HTML documents
Adobe PDF files
xl
Microsoft Excel spreadsheets (note that this value is an abbreviation for
the full file extension, .xls)
ppt
Microsoft PowerPoint presentations
msword
Microsoft Word files
rss
Files formatted for syndication across web sites
text
Plain text files, which typically end with .txt
To continue with the example, say you want to find the phrase astronomy
magazine in only PowerPoint presentations. Append the vf variable, like
so:
search?vp=astronomy+magazine&vp_vt=any&vf=ppt
The number of results is controlled by the n variable, which can be set
only to some predetermined values: 10, 15, 20, 30, 40,or 100. To return
the first 40 results for the phrase astronomy magazine, add the n
variable, like so:
search?vp=astronomy+magazine&vp_vt=any&n=40
There are other variables in advanced search URLs, but these are a few
that will affect the content of search results. Now that you know why the
initial Advanced Web Search URL was so long, you can use some of the
variables to create your own advanced Yahoo! searches on the fly.
Hack 6. Translate Any Page with Yahoo!
The World Wide Web has pages in every language, and Yahoo! can help you
break through the language barrier.
Because the Web is a global space, we've all come across pages in
different languages, especially among search results. If you're searching
for information about a phrase like hamburger recipe, it's strange to come
across a page about it in German. It's stranger still to find a mention of
your name on a page in a foreign language. Imagine my surprise when I was
searching Yahoo! for my name and found it at the Russian site shown in
Figure 1-10.
Figure 1-10. Russian text with my name (Paul Bausch)
I can't read Russian, so of course I had no idea what the text said. I had
recently added a photo gallery of old radio dials to my web site; I could
tell they were linking to it, but I wanted to know what they were saying.
1.7.1. Yahoo! Language Tools
Yahoo!'s Language Tools page (http://tools.search.yahoo.com/language) has
some ways to help you work with other languages. Among them is a
translation service that will translate any block of text to a different
language. I copied the Russian text from Figure 1-10, pasted it into the
text area labeled "Translate this web text," chose "From Russian to
English" from the drop-down list of languages, and clicked Translate.
Yahoo! responded with this:
Radio Dials. The gallery of the photographs of ancient, I will not
beafraid this word, radios-scale. The author of collection,
photographerPaul Bausch, decided thus to publish the paternal collection
of radioreceivers. 3x, dreams about their own tsifrozerkalke with
themacro-objective become increasingly more importunately.
As you can see, the Yahoo! translation tool isn't perfect, but it's good
enough to give a sense of what the page is talking about. The translated
text refers to the "paternal collection" of photos, because the radios I
photographed belonged to my father. I still have no idea what the last
sentence of the translation means, but I'm closer to understanding now
than when it was in Russian.
If you'd like to limit the search results that Yahoo! returns
to one language or a handful of languages, you can set your
preferred languages in your search preferences. By default,
Yahoo! returns the best search results from any language.
A faster way to translate any page you find in Yahoo! Search results is
via the "Translate this page" link included within the results for
non-English pages. Figure 1-11 highlights the link in the search results.
Figure 1-11. The "Translate this page" link in Yahoo! Search results
Clicking the "Translate this page" link takes you to a translated version
of the page, rather than the page in its original language.
If you find yourself translating pages frequently, there are some ways to
speed up the process. You can translate an entire web page by copying and
pasting the URL into the field labeled "Translate this web page" on the
Yahoo! Language Tools page, choosing the language from the drop-down menu,
and clicking Translate. Yahoo! will display the page with all of the text
translated.
Another quick way to translate entire pages is with the Yahoo! Toolbar
[Hack #12]. If you've already installed the Yahoo! Toolbar, choose
Add/Edit Buttons… from the Toolbar Settings button to bring up the
Customize Yahoo! Toolbar page. Check the box next to Translate Current
Page under Search & Navigation and then click Finished. You should now see
a small yellow fish button, like the one shown in Figure 1-12, on your
toolbar.
Figure 1-12. The Translate button on the Yahoo! Toolbar
From any web page, you can click the Translate button and Yahoo! will
display a version in English. Yahoo! will also automatically detect the
source language, so you don't need to choose a language from a menu. This
is also handy if you can't tell what language the page is in. If you just
want to translate a block of text instead of the entire page, you can
click the arrow next to the fish and choose Language and Translation Tools
from the menu; you'll go to the Yahoo! Language Tools page, where you can
paste the text you want to translate into the translation form.
If the Yahoo! Toolbar isn't your style and copying and pasting into the
Language Tools isn't fast enough, you can create your own Translate button
with an understanding of Yahoo! Translation URLs and a JavaScript
bookmarklet.
1.7.2. A Translation Bookmarklet
If you visit the Yahoo! Language Tools page and translate a page by URL,
you'll end up at a Yahoo! page that uses frames. The top frame includes
the Yahoo! Search logo and several links: View Original, Print
Translation, Language Tools, and so on. The bottom frame is the original
web page, with all of the text translated into a different language.
Figure 1-13 shows such a translated page, with the O'Reilly Hacks page in
Spanish in the bottom frame.
Figure 1-13. The Hacks site translated into Spanish
Looking at the URL in the address bar, you'll see that you're at a Yahoo!
page with some parameters passed to it in the querystring, including the
URL of the page to be translated. The whole URL looks like this:
http://tools.search.yahoo.com/language/ translation/translatedPage.
php?tt=url& urltext=http%3A%2F%2Fhacks.oreilly.com%2F& lp=en_es
Here are the three variables passed in the URL:
tt
The type of translation to perform
urltext
The URL of the page to translate
lp
A code that represents the language to translate from and to
Knowing how to build Yahoo! Translate URLs, you can create a bookmarklet
to fetch the current page URL, construct the proper Yahoo! Translate URL,
and open it in a new window.
1.7.2.1. The code.
As with other Yahoo! bookmarklets throughout this book, this JavaScript is
not very readable, but is condensed to work within the confines of a
browser bookmark. Create a new bookmark in your browser and then bring it
up for editing. Put the following code into the location field of the
bookmark and be sure to give the bookmarklet a descriptive name, such as
Yahoo! Translate:
javascript:d=document;void(window.open('http://tools.search.yahoo.com/
language/
translation/translatedPage.php?tt=url&urltext='+escape(d.location.
href)+'&
lp=xx_en','_blank','width=640,height=480,status=yes,resizable=yes,
scrollbars=yes'))
The value of the lp variable in this code is important to note. The value
xx_en tells Yahoo! to determine the language of the page you've sent it to
translate. Of course, you could make this a language-specific bookmarklet
by replacing xx_en with es_en (Spanish to English), fr_de (French to
German), or any one of the other codes for the translations that Yahoo!
supports. To view a full list of translation codes, simply view the source
of the Language Tools page and look at the value attribute in the