You are previewing Google Hacks, 3rd Edition.
O'Reilly logo
Google Hacks, 3rd Edition

Book Description

Everyone knows that Google lets you search billions of webpages. But few people realize that Google also gives you hundredsof cool ways to organize and play with information.

Since we released the last edition of this bestselling book,Google has added many new features and services to its expandinguniverse: Google Earth, Google Talk, Google Maps, Google BlogSearch, Video Search, Music Search, Google Base, Google Reader, andGoogle Desktop among them. We've found ways to get these newservices to do even more.

The expanded third edition of Google Hacks is abrand-new and infinitely more useful book for this powerful searchengine. You'll not only find dozens of hacks for the new Googleservices, but plenty of updated tips, tricks and scripts forhacking the old ones. Now you can make a Google Earth movie,visualize your web site traffic with Google Analytics, postpictures to your blog with Picasa, or access Gmail in your favoriteemail client. Industrial strength and real-world tested, this newcollection enables you to mine a ton of information within Google'sreach. And have a lot of fun while doing it:

  • Search Google over IM with a Google Talk bot

  • Build a customized Google Map and add it to your own website

  • Cover your searching tracks and take back your browsingprivacy

  • Turn any Google query into an RSS feed that you can monitor inGoogle Reader or the newsreader of your choice

  • Keep tabs on blogs in new, useful ways

  • Turn Gmail into an external hard drive for Windows, Mac, orLinux

  • Beef up your web pages with search, ads, news feeds, andmore

  • Program Google with the Google API and language of yourchoice

For those of you concerned about Google as an emerging BigBrother, this new edition also offers advice and concrete tips forprotecting your privacy. Get into the world of Google and bend itto your will!

Table of Contents

  1. Google Hacks, 3rd Edition
    1. A Note Regarding Supplemental Files
    2. Foreword
    3. Credits
      1. About the Authors
      2. Contributors
      3. Acknowledgments
        1. Rael
        2. Paul
        3. Tara
    4. Preface
      1. Why Google Hacks?
      2. How This Book Is Organized
      3. How to Use This Book
      4. How to Run the Hacks
        1. Command-Line Scripts
        2. CGI Scripts
        3. Using the Google API
        4. Learning to Code
      5. Where to Go for More
      6. Conventions Used in This Book
      7. Using Code Examples
      8. Safari® Enabled
      9. How to Contact Us
      10. Got a Hack?
    5. 1. Web
      1. Google Web Search Basics
        1. Phrase Searches
        2. Basic Boolean
        3. Negation
        4. Explicit Inclusion
        5. Synonyms
        6. Number Range
        7. Simple Searching and Feeling Lucky
        8. Case Sensitivity
      2. Full-Word Wildcards
      3. Special Syntax
      4. Mixing Syntax
        1. How Not to Mix Syntax
        2. How to Mix Syntax
          1. Titles and sites
          2. Title and URL
        3. The Antisocial Syntax Elements
        4. All the Possibilities
      5. Advanced Search
        1. Query Words
        2. Language
        3. File Format
        4. Date
        5. Occurrences
        6. Domain
        7. Usage Rights
        8. Safe Search
        9. Page-Specific Search
      6. Quick Links
      7. Language Tools
        1. Search Specific Languages or Countries
        2. Translate
        3. Interface Language
        4. Local Domain
        5. Making the Most of Google’s Language Tools
      8. Anatomy of a Search Result
      9. Setting Preferences
        1. Interface Language
        2. Search Language
        3. SafeSearch Filtering
        4. Number of Results
        5. Results Window
        6. Settings for Researchers
      10. Understanding Google URLs
      11. Hack #1. Browse the Google Directory
        1. Searching Versus Browsing
        2. Searching the Google Directory
      12. Hack #2. Glean a Snapshot of Google in Time
        1. See Also
      13. Hack #3. Visualize Google Results
        1. Starting to Browse
        2. Expanding Your View
        3. Visualization Options
        4. Making the Most of These Visualizations
      14. Hack #4. Check Your Spelling
        1. Embrace Misspellings
        2. Spelling on the Command Line
          1. The code
          2. Running the hack
      15. Hack #5. Google Phonebook: Let Google’s Fingers Do the Walking
        1. The Three Syntaxes
        2. Using the Syntaxes
        3. Caveats
          1. Syntaxes are case-sensitive
          2. Wildcards don’t work
          3. Exclusions don’t work
          4. OR doesn’t always work
        4. Reverse Phonebook Lookup
      16. Hack #6. Look Up Definitions
        1. Google Definitions
        2. Slang
        3. Industrial Slang
        4. Researching Terminology with Google
        5. Where to Go When It’s Not on Google
      17. Hack #7. Find Directories of Information
        1. Title Tags and Wildcards
        2. Finding Searchable Subject Indexes with Google
      18. Hack #8. Cover Your Bases
      19. Hack #9. Hack Your Own Google Search Form
        1. Hidden Variables
        2. Mixing Hidden File Types: an Example
        3. Creating Your Own Google Form
      20. Hack #10. Compare Google and Yahoo! Search Results
        1. Twingine
        2. Yahoo! Versus Google Diagram
        3. Piling Results Together
      21. Hack #11. Cover Your Tracks
        1. Browser History
        2. Saved Form Data
        3. Browser Cache
      22. Hack #12. Improve Google’s Memory
      23. Hack #13. Find Out What Google Thinks ___ Is
        1. The Interface
        2. What You Get Back
        3. Practical Uses
        4. Expanding the Application
      24. Hack #14. Browse the World Wide Photo Album
        1. Random Personal Picture Finder
        2. Searching Personal Sites
      25. Hack #15. Find Similar Images
        1. The Code
        2. Running the Hack
      26. Hack #16. Track Stocks
        1. Beyond Google for Basic Stock Information
        2. More Stock Research with Google
    6. 2. Advanced Web
      1. Assumptions
      2. Hack #17. Assemble Advanced Search Queries
        1. Anatomy of an Advanced Search URL
        2. Building Advanced Search URLs
      3. Hack #18. Like a Version: Search with Synonyms
        1. The Code
        2. Running the Hack
      4. Hack #19. Capture Google Results in a Google Box
        1. The Code
        2. Running the Hack
        3. Integrating a Google Box
        4. The Official Google Box
      5. Hack #20. Cook with Google
        1. The Code
        2. Running the Hack
        3. Hacking the Hack
      6. Hack #21. Permute a Query
        1. The Code
        2. Running the Hack
      7. Hack #22. Summarize Results by Domain
        1. The Code
        2. Running the Hack
        3. Hacking the Hack
          1. Going back for more
          2. Returning comma-separated output
      8. Hack #23. Measure Google Mindshare
        1. The Code
        2. Running the Hack
        3. Fun Hack Uses
      9. Hack #24. SafeSearch Certify URLs
        1. The Code
        2. Running the Hack
        3. Hacking the Hack
      10. Hack #25. Search Google Topics
        1. Why Topic Search?
        2. The Code
        3. Running the Hack
        4. Search Ideas
        5. See Also
      11. Hack #26. Run a Google Popularity Contest
        1. The Code
        2. Running the Hack
      12. Hack #27. Scrape Yahoo! Buzz for a Google Search
        1. The Code
        2. Running the Hack
        3. Hacking the Hack
      13. Hack #28. Compare Google’s Results with Other Search Engines
        1. The Code
        2. Running the Hack
        3. Why?
      14. Hack #29. Scattersearch with Yahoo! and Google
        1. The Code
        2. Running the Hack
        3. Hacking the Hack
      15. Hack #30. Yahoo! Directory Mindshare in Google
        1. The Code
        2. Running the Hack
        3. Hacking the Hack
      16. Hack #31. Spot Trends with Geotargeting
        1. Uses of Geotargeting
        2. The Code
        3. Running the Hack
        4. Hacking the Hack
      17. Hack #32. Bring the Google Calculator to the Command Line
        1. The Code
        2. Running the Hack
      18. Hack #33. Build Your Own Google Search Feeds
        1. The Code
        2. Running the Hack
        3. Hacking the Hack
      19. Hack #34. Search Google by Link Graph
        1. The Code
        2. Running the Hack
        3. See Also
      20. Hack #35. Download Google Videos as AVI Files
        1. Converting FLV Video to AVI
        2. The Code
        3. Running the Hack
    7. 3. News and Blogs
      1. Google News
        1. Google News Search Syntax
        2. Advanced News Search
        3. Making the Most of Google News
        4. Receiving Google News Alerts
      2. Google Groups
        1. Ten Seconds of Hierarchy Funk
        2. Browsing Groups
        3. Google Groups Search Syntax
        4. Mixing Syntaxes in Google Groups
          1. Some common search scenarios
          2. Tech support
          3. Finding commentary immediately after an event
        5. Advanced Groups Search
      3. Blogs
        1. Blogger
        2. Google Blog Search
        3. Google Blog Search Syntax
      4. Beyond Google for News and Blogs
      5. Hack #36. Scrape Google News
        1. The Code
        2. Running the Script
        3. Hacking the Hack
      6. Hack #37. Visualize Google News
      7. Hack #38. Map Google News
        1. Geocoding
        2. The Code
        3. Running the Hack
      8. Hack #39. Track Your Favorite Sites
        1. Finding Feeds
          1. Go to the source
          2. Look for autodiscovery
          3. Look for Add to Google
        2. Adding to Google Homepage
        3. Adding to Google Reader
      9. Hack #40. Scrape Google Groups
        1. The Code
        2. Running the Hack
      10. Hack #41. Seek Out Blog Commentary
        1. Google Blog Search
        2. Google Web Search
          1. Finding “magic words.”
          2. Using these “magic words.”
      11. Hack #42. Glean Blog-Free Google Results
        1. The Code
        2. Running the Hack
        3. Hacking the Hack
      12. Hack #43. Find Blog Commentary for Any URL with a Single Click
        1. The Code
        2. Running the Hack
      13. Hack #44. Track Topics on Blogs over Time
        1. The Code
        2. Running the Hack
        3. Working with the Results
      14. Hack #45. Blog from Your Desktop
        1. w.bloggar
        2. Ecto
          1. Ping services
          2. Tags
        3. Blogger for Word
      15. Hack #46. Program Blogger with PHP
        1. What You Need
        2. The Code
        3. Running the Hack
    8. 4. Extending Google
      1. Hack #47. Keep Tabs on Your Searches with Google Alerts
      2. Hack #48. Google Your Desktop
        1. Installing the Google Desktop
        2. Searching Your Desktop
        3. Google Desktop Search Syntax
        4. Searching the Web
        5. Behind the Scenes
        6. Google Desktop Sidebar
        7. Twiddling Knobs and Setting Preferences
        8. Extending Google Desktop
      3. Hack #49. Google with Bookmarklets
      4. Hack #50. Google from IRC
        1. The Code
        2. Running the Hack
      5. Hack #51. Google on the Go
        1. Google by PDA or Smartphone
        2. Google by Cell Phone
        3. Google by SMS
        4. Froogle on the Go
        5. Maps on the Go
      6. Hack #52. Google over IM
        1. What You Need
        2. The Code
        3. Running the Hack
        4. See Also
      7. Hack #53. Googlify Your Browser
        1. Features
          1. Web search
          2. PageRank
          3. Blog This!
          4. Page information
          5. Spellchecking
        2. Installation
        3. Privacy
      8. Hack #54. Search with Google from Any Web Page
        1. The Code
        2. Running the Hack
      9. Hack #55. Customize the Firefox Quick Search Box
        1. The Code
        2. Running the Hack
      10. Hack #56. Build a Google Screensaver
        1. The Code
        2. Running the Hack
          1. On Mac OS X
          2. On Windows XP
      11. Hack #57. Add a Feed to Google Quickly
        1. Internet Explorer
          1. The code
          2. Running the hack
        2. Firefox
      12. Hack #58. Tame Long Google URLs
        1. Trimming Google URLs
        2. URL-Trimming Services
      13. Hack #59. Autocomplete Search Terms as You Type
        1. The Code
        2. Running the Hack
      14. Hack #60. Refine Your Google Search
        1. The Code
        2. Running the Hack
      15. Hack #61. Make Google More Accessible for Low-Vision Users
        1. The Code
        2. Running the Hack
      16. Hack #62. Search for Lyrics on Google
        1. The Code
        2. Running the Hack
    9. 5. Google Maps
      1. Hack #63. Think Global, Google Local
      2. Hack #64. Get Around http://maps.google.com
        1. What’s Different About Google Maps?
        2. Getting Around
        3. Entering a Location
      3. Hack #65. Find Yourself (and Others) on Google Maps
        1. Odd and Surprising Ways to Find Things
        2. When Locations Fail: The Importance of Context
      4. Hack #66. Build Your Own Google Map
        1. Google Map Maker
        2. Setting Your API Key
        3. Rolling Out Your Map
        4. Hacking the Hack
      5. Hack #67. Add a Google Map to Your Web Site
        1. Get a Developer Key
        2. Hello, World!
        3. Getting Outside of Your Head
        4. Getting Right to the Point
        5. See Also
      6. Hack #68. Map Flickr Contacts
        1. Geocoding a Location
        2. What You Need
        3. The Code
        4. Running the Hack
      7. Hack #69. Fly Across the Earth
        1. Navigating Google Earth
        2. Adding Layers of Information
        3. Sharing Your Locations
    10. 6. Gmail
      1. Signing Up
      2. Gmail Search Syntax
        1. Phrase Searches
        2. Basic Boolean
        3. Negation
        4. Grouping
        5. Mixing Syntax
      3. Gmail Chat
      4. Additional Resources
      5. Hack #70. Create and Use Custom Addresses
      6. Hack #71. Import Your Contacts into Gmail
        1. Anatomy of a Contacts CSV
        2. Feed CSV to Gmail
        3. Out of Outlook (Express)
        4. Hopping Out of Hotmail
          1. By way of Outlook (Express)
          2. By way of copy-and-paste
        5. Yumping from Yahoo!
        6. Moving from .Mac
        7. Hand-Crafting a CSV
        8. Last-Ditch Effort
      7. Hack #72. Import Mail into Gmail
        1. Forward Desktop Mail
          1. Installing the hack
          2. Running the hack
          3. Hacking the hack
        2. Migrate from an Existing Web Mail Service
        3. See Also
      8. Hack #73. Export Your Gmail
        1. Installing the Hack
        2. Running the Hack
        3. See Also
      9. Hack #74. Gmail on the Go
        1. Gmail Mobile
        2. Gmail-mobile PHP
          1. Installing the hack
          2. Running the hack
        3. See Also
        4. Other Options
      10. Hack #75. Use Gmail as a Linux Filesystem
        1. Implementation Details
        2. Installing the Hack
        3. Running the Hack
        4. Things You Should Know
        5. Outstanding Issues
        6. See Also
      11. Hack #76. Use Gmail as a Hard Drive
        1. See Also
      12. Hack #77. Program Gmail
        1. Python
          1. Installing the hack
          2. The code
          3. Running the hack
          4. Hacking the hack
        2. See Also
        3. Perl
        4. PHP
        5. Java
        6. .NET
      13. Hack #78. Force Gmail to Use a Secure Connection
        1. The Code
        2. Running the Hack
        3. Hacking the Hack
    11. 7. Webmastering
      1. Google’s Importance to Webmasters
      2. The Mysterious PageRank
      3. The Equally Mysterious Ranking Algorithm
      4. Tools for Webmasters
        1. Google Sitemaps
        2. Google Analytics
        3. Google AdWords
        4. Google AdSense
      5. Keeping Up with Google’s Changes
      6. In a Word: Relax
      7. Hack #79. A Webmaster’s Introduction to Google
        1. Search Engine Basics
        2. Submitting Your Site to Google
        3. The Search Engine Optimization Template
      8. Hack #80. Get Inside the PageRank Algorithm
        1. What’s the Algorithm?
        2. What Does It Mean?
        3. What’s the Use of the PageRank Calculator?
        4. How Does the PageRank Calculator Work?
      9. Hack #81. 26 Steps to 15 KB a Day
        1. A. Prep Work
        2. B. Choose a Brandable Domain Name
        3. C. Site Design
        4. D. Page Size
        5. E. Content
        6. F. Keyword Density and Keyword Positioning
        7. G. Outbound Links
        8. H. Cross-Links
        9. I. Put It Online
        10. J. Submit
        11. K. Logging and Tracking
        12. L. Spiderings
        13. M. Topic Directories
        14. N. Links
        15. O. Content
        16. P. Gimmicks
        17. Q. Linkbacks
        18. R. Rounding Out Your Offerings
        19. S. Beware of Flyer and Brochure Syndrome
        20. T. Keep Building One Page of Content Per Day
        21. U. Study Those Logs
        22. V. Timely Topics
        23. W. Friends and Family
        24. X. Notes, Notes, Notes
        25. Y. Submission Check at Six Months
        26. Z. Keep Building Those Pages of Quality Content!
      10. Hack #82. Be a Good Search Engine Citizen
        1. Thou Shalt Not:
          1. Cloak
          2. Hide text
          3. Use doorway pages
          4. Check your link rank with automated queries
          5. Link to “bad neighborhoods.”
        2. Thou Shalt:
          1. Create great content
        3. What Happens If You Reform?
        4. What Happens If You Spot Google Abusers in the Index?
      11. Hack #83. Clean Up for a Google Visit
      12. Hack #84. Remove Your Materials from Google
        1. Google Web Search
          1. Making sure your pages never get there to begin with
          2. Removing your pages after they’re indexed
          3. Removing that content now
          4. Reporting pages with inappropriate content
        2. Google Images
        3. Google Groups
          1. Preventing your material from being archived
          2. Removing materials after the fact
        4. Google Phonebook
      13. Hack #85. Get the Most Out of AdWords
        1. Dynamic Keyword Insertion: Beware
        2. Run Better Tests
        3. Run Smarter Reports
        4. Control Your Ad Positions
        5. Don’t Be a Slave to Automation
        6. Control Your Content Bidding
        7. Control Your Geography
      14. Hack #86. Generate Google AdWords
        1. Choosing AdWords
        2. Exploring Your Competitors’ AdWords
      15. Hack #87. Scrape Google AdWords
        1. The Code
        2. Running the Hack
      16. Hack #88. Add Search to Your Site
        1. Google Free
        2. AdSense for Search
      17. Hack #89. Feed News to Your Web Site
        1. Finding a Feed
        2. The Code
        3. Running the Hack
    12. 8. Programming Google
      1. Signing Up and Google’s Terms
      2. The Google Web APIs Developer’s Kit
      3. Using Your Google API Key
      4. What’s WSDL?
      5. Understanding the Google API Query
        1. Query Essentials
        2. A Sample
        3. Intersecting Country, Language, and Topic Restrictions
        4. Putting Query Elements to Use
      6. Understanding the Google API Response
        1. Can Do
        2. Can’t Do
        3. The 10-Result Limit
        4. What’s in the Results
          1. Aggregate data
          2. Individual search result data
      7. Beyond Web APIs
      8. A Note on Spidering and Scraping
      9. Hack #90. Program Google in Perl
        1. The Code
        2. Running the Hack
      10. Hack #91. Install the SOAP::Lite Perl Module
        1. Unix and Mac OS X Installation via CPAN
        2. Unix Installation by Hand
        3. Windows Installation via PPM
        4. A Note About Expat
      11. Hack #92. Program Google with the Net::Google Perl Module
        1. The Code
        2. Running the Hack
      12. Hack #93. Loop Around the 10-Result Limit
        1. The Code
        2. Running the Hack
        3. Hacking the Hack
      13. Hack #94. Program Google in Java
        1. The Code
        2. Compiling the Code
        3. Running the Hack
      14. Hack #95. Program Google in Python
        1. PyGoogle Installation
        2. The Code
        3. Running the Hack
        4. Hacking the Hack
      15. Hack #96. Program Google in C# and .NET
        1. The Code
        2. Compiling the Code
        3. Running the Hack
      16. Hack #97. Program Google in VB.NET
        1. The Code
        2. Compiling the Code
        3. Running the Hack
      17. Hack #98. Program Google with ColdFusion
        1. The Code
        2. Running the Hack
      18. Hack #99. Program Google with PHP 5
        1. The Code
        2. Running the Hack
      19. Hack #100. Program Google with VBScript
        1. What You Need
        2. The Code
        3. Running the Hack
    13. 1. Track News About Google
      1. Google Sources
      2. Outside News Sources
      3. Google Employee Blogs
      4. Grassroots Sources
    14. About the Authors
    15. Colophon