Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

Marcel's Linux Walkabout: Information Unlimited

For the Net-connected news junkie, the relentless march of information makes it hard to keep up. On his Linux Walkabout, Marcel Gagne shows you how to add extra reading hours to your day by using your Linux system, Sitescooper, and your Palm handheld.
Like this article? We recommend

I confess!

They say confession is good for the soul, so today, right here, in this very column, my Linux Walkabout, I will make public one of the deepest and darkest secrets of my soul. In making this confession, I will tell you about a great little tool for your Linux system. In that way, I may just help others who are similarly afflicted.

Steady Marcel, you can do this.

Okay, I'm ready. Here it is. I am a news junkie. I'm cursed with a maniacal and insatiable need to be up on the latest in current events, science, entertainment, politics, rumor, and whatever else you can think of. For reasons that defy explanation, I need a steady diet of information about anything and everything that is going on in the world; nay, in the entire universe. Though I must confess (again?) a particular fondness for information of a scientific or technical nature, I can just as easily be swayed by a review of the Canadian Opera Company's latest performance or by speculation on the newest blockbuster. Information...I must have information.

Oh, and fiction, too. Lots and lots and lots of fiction. Text, that's the key. <insert maniacal laugh here> Ah, I feel much better. This is probably part of the reason that one of my favorite toys is my Visor Prism, a Palm OS device with the signature springboard slot. In that slot, I have an expansion card, a MemPlug that gives my Visor an extra 64MB of storage space. What do I do with that extra space? I store the latest stories and headlines from my favorite news sources. I also keep a dozen or so novels there, but today I'm going to concentrate on the news.

Justin Mason must have been one of the afflicted. That's probably why he wrote Sitescooper, a nice little program that's actually just a clever piece of perl code. What Sitescooper does is provide an easy way to download, clean up, and format your favorite news website so that you can read it on your Palm (or similar) handheld device. Since there are a number of reader programs available for handhelds, Sitescooper knows about many of the more popular ones—such as iSilo, Plucker, RichReader, and any of the numerous programs that make use of the DOC format (Aportisdoc, Tealdoc, and so on). It collects the news by using site description files that you can write yourself, although you may never need to. Sitescooper comes with some 400 different site files preconfigured.

Intrigued? Then head on over to http://sitescooper.sourceforge.net and pick up the latest source. Installation is easy, as I will show you in a moment, but you can make life even easier by downloading prepackaged RPM files (for RedHat, SuSE, and others) and DEBs for the Debian folk. Or, you can go to the source.

tar -xzvf sitescooper-full.tar.gz
cd sitescooper-3.1.2
su -c "make install"

Earlier on, I talked about site description files. We'll get to those in a moment, but for now, let's look at Sitescooper's one configuration file. It is called sitescooper.cf, and you'll find it in the /etc directory for the global file or in your $HOME/.sitescooper directory. Since this is a simple text file, you can edit it with your favorite editor (mine is still vi). There are two lines that you need to look for and uncomment. Here's the first:

   PilotInstallDir: $HOME/pilot/install

When Sitescooper creates files for you to hotsync to your Palm, it needs a place to store them. That's what you do with the PilotInstallDir setting ahead. I've got mine set to pilot/install in my home directory. This can be pretty much anywhere you want. The alternative is to try to let Sitescooper figure these things out for itself by setting the PilotInstallApp parameter.

   PilotInstallApp: InstallApp

Replace the word InstallApp with the pilot sync program you are using: PilotManager, gnome-pilot, or JPilot. Once that is done, you are almost done.

Now, type sitescooper. When you run Sitescooper for the first time, it will create a .sitescooper directory (don't forget the period) in your home directory. The first thing you will notice, however, is that you've just been placed in the middle of a configuration file for sites to download news from, and there are a lot of them. This is the format you'll see:

   [ ] New Scientist
    URL: http://www.newscientist.com/contents/
    Filename: [samples]/science/new_scientist.site

   [ ] Science Daily Headlines
    URL: http://www.sciencedaily.com/news/summaries.htm
    Filename: [samples]/science/science_daily.site

The idea is simple. Simply put an X in-between the square brackets of the sites that interest you. This is a big list, so you might be busy for a while. The other option at this point is to ignore this file: Don't change anything, and close it right now (which is what I did). What will happen then is that Sitescooper will create a number of additional files and directories in that .sitescooper directory I told you about earlier. When you run the program, it will expect to see a directory called sites under your home directory. This is where you keep individual site files. Take a moment and go back to where you extracted Sitescooper, and you will discover a directory called site_samples (if you installed from source, you'll also find these under /usr/share/sitescooper). There you'll find a number of other directories representing the categories below. In the science directory, I find this site file for New Scientist website:

   $ cat new_scientist_news.site
   URL: http://www.newscientist.com/news/
    Name: New Scientist News
    Levels: 2
    UseTableSmarts: 0
    TableRender: flatten
    ContentsStart: <div class\s*=\s*"crosshead">
    ContentsEnd: <div class\s*=\s*"listfoot" align\s*=\s*"justify">

    StoryURL: http://www.newscientist.com/news/news_\d+.html
    StoryURL: http://www.newscientist.com/(daily)?news/news.jsp\?id=ns\d+
    StoryHeadline: <title>New Scientist: (.*?)</title>
    StoryStart: <div class\s*=\s*"body">
    StoryEnd: <B class\s*=\s*subs>

As you can see, the format is quite simple. With over 400 site files pre-built for you, odds are you won't need to go looking for more on your first day, but just in case, you might want to take down the following link. It is a simple set of instructions for creating your own site files:

http://www.sitescooper.org/doc/writing_site.html

The following listing is that of a site file I wrote for myself. It scoops the weekend book review column (a must-read for the book lovers out there).

   #The Globe and Mail is a a Toronto newspaper
   #This script scoops the weekend Books review column

   URL: http://www.globebooks.com/
    Name: Globe&Mail Books
    Levels: 2

    ContentsStart: <!-- Feature Review -->
    ContentsEnd: <!-- Best of he Year -->

    StoryURL: http://www.globebooks.com/servlet/.*
    StoryStart: <!-- /fragments/emailtofriend.html ends -->
    StoryEnd: <!-- Addendum -->

All right, let's get some news. If you run the program in its simplest form, it creates files in iSilo format by default. The resulting file is prefixed by the date of the story.

2002_05_30_New_Scientist_News.pdb

Personally, I don't like this naming convention. What I want it new news, not yesterday's or last week's news. Consequently, I would rather have the file without that prefix so that new files overwrite old files when I hotsync. For that, I use the -nodates option.

   sitescooper -nodates -fullrefresh

Notice that I added another option: the -fullrefresh flag. That's because Sitescooper is pretty smart. It uses a cache to remember whether it has already downloaded today's news so that it doesn't go out and get the same thing over and over again. To override that, I tell it to fully refresh its cache and start from scratch. Now my file name looks a bit less dated.

New_Scientist_News.pdb

Of course, not everyone will be using iSilo as their reader. The most common reader format is arguably Palm doc, and many readers can handle this one. In order to generate Palm doc format files, use the -doc flag as well. This one is kind of boring since it creates a single long document without an index. For a table of contents with cross-linked stories, you are best with the iSilo and Plucker. I personally use a number of readers since no single one satisfies all my desires for formatted text. But I digress.

I brought up different formats at this time because this is where you may be starting to run into problems. The conversion to formats like iSilo, Palm doc, Plucker, RichReader, and so on, requires external programs. In the case of iSilo, you may need the iSilo conversion tool for Linux. You can get it at this address:

http://www.isilox.com/download/iSiloXC386.htm

The Plucker format also requires a conversion tool. This is also a free tool (available in RPM and binary tarball) and you can get it at the following address.

http://www.plkr.org/index.pl/download

I've grown quite fond of the Plucker format (see Figure 1). I run it with the -mplucker flag to create multipage HTML documents readable on my Visor. When I ran it for the first time, the PDB files (which should have been created) were nowhere to be found. I also got an error telling me that db_name was no longer a valid option. A little search through the Sitescooper mailing list archives provided the answer to my problem.

Figure 1Figure 1 Reading scooped web news with Plucker.

The problem resides in the Main.pm file distributed with the tarball (who knows, it may be fixed by the time you read this). If you installed from the tarball, this file will be living in the /usr/local/share/sitescooper/lib/Sitescooper directory. Edit the file and look for db_file, and change it to doc_file. You also need to change db_name to doc_name. There's only one reference for each one, so it should be fairly easy to spot them.

This is all wonderful if you happen to own a Palm or a Visor, and you find yourself in situations where portable news is the only way to catch up. But what if you don't need to carry all this with you? What if you don't own one of those funky handhelds? Sitescooper can still be a great time-saver. Sitescooper also lets you capture sites in all their HTML glory, but with the news only. Here's the command I use:

   sitescooper -fullrefresh -mhtml -color -nodates -noheaders -nofooters

Since I've thrown a few additional flags at you, I should probably explain. The -mhtml flag tells Sitescooper to download html, but to maintain the multi-level format. The -html flag downloads in HTML format, but the entire site becomes one big page. The -color flag tells Sitescooper that my Palm device can display color, so there's no need for black and white conversion. The other flags of interest here are -noheaders and -nofooters.

I also run another collection command so that I can hotsync my daily Visor news fix:

   sitescooper -mplucker -color -nodates -noheaders -nofooters

And speaking of "every day," running these commands might get a little tedious. So why not create a script with the appropriate commands and run that script via a cron job? What could be more perfect? You get to your computer in the morning, and there, waiting for you, is the latest of the day's news, collected while you slept. Create a small script (with the above commands, perhaps?), and set a date and time for the job to run. Let's pretend that my script is called get_news_now. Here's a cron entry for a job that runs every morning at 5 AM.

  0 5 * * * /home/marcel/scripts/get_news_now 1> /dev/null 2> /null

If you are like me, you'll have discovered many opportunities for wasting valuable time with the help of this little program. Sitescooper may not have cured my news addiction, but at least I'll be well informed. Well, it's time to wrap it up for today. Besides, I've got a lot of reading to do.

Next time on the Walkabout, I'm going to take you into the hinterlands, the backwaters, the deepest, darkest corners of the Linux universe. Well, maybe it won't be quite that scary. Better stock up on that programmer food, just in case.

Until next time, I bid you great Linux adventures!

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020