Personalize, Track, and Share the Web

A free Yahoo! service called My Web remembers your searches, saves copies of web pages, and shares your saved pages with others.

The Yahoo! My Web beta gives you a powerful set of tools to collect web pages, annotate them, and share them with others. In My Web, you can save links to your favorite web sites (much like bookmarks) and organize them in custom folders. But there are several features available at My Web beyond collecting links:

Site Notes

You can add notes to any saved web site in My Web. You can use these notes to provide a site description, personal comments about the site, or any other bits of text.

Copies of Web Pages

Instead of saving just a link to a web site, My Web saves a copy of a page as it looked when you added it My Web. So even if a web page changes between when you added the site to My Web and when you want to reference it later, you can be sure you’ll see the original information.

Search History

If you enable Search History, Yahoo! will remember which sites you click on in any Yahoo! search results and save them to your My Web History folder. If you have trouble remembering what search term you used to find a particular site, this might be a useful feature for you.

Blocked Sites

Some sites that show up in search results simply aren’t relevant and won’t be relevant to any search you make. Clicking Block tells Yahoo! not to show that particular site in your future search results. Blocked sites show up in your My Web Blocked folder, so you can periodically review the sites you’ve blocked.

Shared Folders

By default, folders with links and copied pages are private, but you can also choose to share any particular folder with the world. My Web also makes RSS feeds available for shared folders so others can subscribe to them and keep up with your changes.

To get started with My Web you just need a free Yahoo! ID. Browse to http://myweb.search.yahoo.com/myweb and log in with your Yahoo! ID. As you activate My Web, you’ll have the option to import any existing Yahoo! Bookmarks (http://bookmarks.yahoo.com) and the option to download the latest Yahoo! Toolbar (http://toolbar.yahoo.com), which is a quick way to add links to My Web as you browse other sites.

Using My Web

Once you’ve enabled My Web, you’ll see some extra options as you search with Yahoo!. Make sure you’re logged into Yahoo! and then browse to http://search.yahoo.com. The first change you’ll notice is a My Web link under the Yahoo! logo, and the status of your Search History feature, as shown in Figure 1-15.

My Web link and Search History status at Yahoo! Search

Figure 1-15. My Web link and Search History status at Yahoo! Search

Click Off or On at any time to enable or disable the Search History feature, respectively.

Each search result on the page will also have two links—Save and Block—as shown in Figure 1-16.

The Save and Block links on a search result

Figure 1-16. The Save and Block links on a search result

Clicking Save brings up a form on the page that will allow you to choose a folder to save the site in, and a text field for adding notes to the site. Figure 1-17 shows the Save form.

The Save form on a search result

Figure 1-17. The Save form on a search result

Clicking Block produces the message shown in Figure 1-18, notifying you that the site will be blocked from future searches.

Notification that a site has been blocked

Figure 1-18. Notification that a site has been blocked

You can click Unblock Site to restore the site in the current search results, or you can visit your Blocked folder to put the site back into view on future searches.

If you want to take the features of My Web with you to other web sites, you can use the Yahoo! Toolbar [Hack #12] . If you don’t see the My Web button represented by a yellow folder on your toolbar, be sure you have the latest version of the toolbar (available at http://toolbar.yahoo.com). You can also choose Add/Edit Buttons from the toolbar settings button, check the box next to My Web under Personal Tools, and click the Finished button. Once the My Web button is installed, you should see it with its related pull-down menu, as shown in Figure 1-19.

Yahoo! Toolbar My Web menu

Figure 1-19. Yahoo! Toolbar My Web menu

If you want to save a particular web page, click on the yellow folder icon with the green plus (+) sign. The pop-up window—like the one shown in Figure 1-20—lets you modify the saved title, add a note about the page, save it to a specific My Web folder, and store the actual contents of the page just as if you’d clicked the Save button next to a Yahoo! Search result.

Sharing My Web

As you browse through your saved sites at http://myweb.search.yahoo.com/myweb, you have the option to make folders full of sites public (they’re private by default). Simply click the radio button next to Public in the My Web folder publishing options (see Figure 1-21).

Once your My Web folder is public, anyone will be able to view the sites you’ve saved to that folder in a number of ways. You can share the collection of web pages in a My Web folder directly via a predictable URL. Public folder URLs follow this pattern:

	http://myweb.search.yahoo.com/myweb/user/hashed account/folder name
Yahoo! My Web “Save this page” pop-up window

Figure 1-20. Yahoo! My Web “Save this page” pop-up window

Yahoo! My Web folder publishing options

Figure 1-21. Yahoo! My Web folder publishing options

The hashed account in the URL is a text string that is an encrypted version of your account name. To find your particular hashed account text, click the Preview link in your folder publishing options and take a look at the URL. You should see a seemingly random string of characters in the URL, something like this:

	YZWDcbcIupRv2bLnSax_Qg—

This is your hashed account name, and you can use it to build URLs to shared folders. The folder name in the URL pattern is, predictably, the name of the public folder. So if your folder is named ToddTechFinds, the final URL would look like this:

	http://myweb.search.yahoo.com/myweb/user/YZWDcbcIupRv2bLnSax_Qg—/ 
	ToddTechFinds

You could then pass this URL along to friends or coworkers so that they can see the sites you’ve gathered together. If you frequently update the folder, there are a couple of options that let others subscribe to any public My Web folder.

People viewing your site with a My Yahoo! account can choose to add your page to their My Yahoo! RSS feed list. This lets them get updates about content in your shared folder. And Yahoo! also provides a direct link to the syndicated RSS 2.0 format XML. The RSS feeds also have a predictable URL that follows this pattern:

	http://myweb.search.yahoo.com/myweb/user/hashedaccount/foldername/rss.xml

Of course, this RSS 2.0 feed URL can be found by clicking on the familiar XML button.

Programming My Web

In addition to the web and RSS options available for sharing My Web sites, you can access your public folders via Yahoo! Web Services. The documentation for the My Web API is found at http://developer.yahoo.net/myweb.

There are two public My Web functions. The listFolders function lists the public folders for a Yahoo! My Web account. You can call it like so:

	http://api.search.yahoo.com/MyWebService/V1/listFolders?appid=insert 
	appID&yahooid=insert Yahoo! ID&results=10

Replace insert appID with your own Yahoo Application ID and use someone else’s Yahoo! ID for insert Yahoo! ID. The URL returns an XML page that contains a list of that user’s public folders, along with the number of sites in that folder. You can parse the XML with any programming environment.

The listUrls function returns information about a specific public folder. You can call it with a URL like this:

	http://api.search.yahoo.com/MyWebService/V1/listUrls?appid=insert 
                 
	              appID&yahooid=insert Yahoo! ID&folder=insert public folder&results=10

This function is handy for browsing the contents of folders you found with the listFolders function.

A basic example of using My Web data programmatically is to display the sites in a public folder on a remote web site—a perfect job for PHP.

The code.

The PHP 5 integrated SimpleXML module makes parsing and displaying the XML easy. The simplexml_load_file() function retrieves the My Web web services–generated XML for easy parsing. The foreach loop iterates through the list of saved web pages and lets you extract individual items. Note that the tag names are case-sensitive. For example, $result->Url succeeds, but $result->URL fails.

The following simple PHP 5 script, showMyWebFolder.php, displays the contents of a public My Web folder:

	<?php
	$myweb = simplexml_load_file('http://api.search.yahoo.com/MyWebService/V1/ 
	listUrls?appid=insert appID&yahooid=insert Yahoo! ID&folder=insert public 
                   
	folder&results=10');

	print "<h2>Shared Links</h2>"; 
	foreach ($myweb->Result as $result) 
    {
        $date_text = $result->StoreDate;
		$summary_text = $result->Summary;
		$title_text = $result->Title;
		$url_text = $result->Url;
		$note_text = $result->Note;

		print "<h3>" . date("M d, Y", $date_text) . "</h3>\n";
		print "<a href=\"$url_text\">";
		print $title_text;
		print "</a>" . "<br />";
		print "<div>$summary_text</div><br />";
		print "<div style=\"background:#eee;\"><b>Notes:</b>
		       $note_text</div>";
    }

Be sure to create and include a unique application ID and insert your own Yahoo! ID and public folder name.

Running the hack.

Upload showMyWebFolder.php to your server and bring it up in a browser. You should see a simple HTML page, like the one shown in Figure 1-22. This page shows the links, notes, and date each site was added to the public folder.

The contents of a My Web folder on a remote site

Figure 1-22. The contents of a My Web folder on a remote site

At the time of this writing, My Web is still in beta testing, but with its powerful abilities to annotate, share, and shape search results, My Web will likely be a standard part of Yahoo! in the future.

Todd Ogasawara and Paul Bausch

Get Yahoo! Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.