in reply to Re: How to browse using WWW::Mechanize::Firefox
in thread How to browse using WWW::Mechanize::Firefox

I'm getting this output through my perl script also,
#!perl -w use strict; use WWW::Mechanize::Firefox; my $mech = WWW::Mechanize::Firefox->new(); $mech->get('http://www.lcps.org/Page/2309'); my $cal_content= $mech->content; while($cal_content=~m/"fc-event-title\s*ellipsis"(\s|\w)*>(.*?)<\/span +>/g){ print $2."\n"; }
But the issue is how to get the dates too respective with their events. e.g. Output should be like this : 01/05/2012 Spanish I A Days 03/05/2012 Mi Familia- Oral presentation TODAY!!! Spanish I B days 04/05/2012 Mi Familia Oral Presentation TODAY!!! Spanish I A days 01/05/2012 Spanish II 08/05/2012 Spanish II Chapter 3A Quiz 28/05/2012 HOLIDAY (Memorial Day) Please make the changes in perl script itself.

Replies are listed 'Best First'.
Re^3: How to browse using WWW::Mechanize::Firefox
by Corion (Patriarch) on May 29, 2012 at 08:24 UTC

    You will have to do some programming then. You will need to correlate the positions of the events with the date information. Personally, I would do that by using the page co-ordinates, but likely you can also get by by determining the column in which an element is positioned.

    I won't write a program for you because that requires deeper analysis and investment of more time than I'm willing to spend on what is mostly trial and error.

    Update: Consider switching the view to "List" view, then you should be able to easily extract the date and the description from the same HTML element. Also, that page exports RSS and ICal views as well - instead of scraping, I recommend you use the data in these formats.

        WWW::Mechanize::Firefox can "click" on any page element, even if it does not appear as "link". But you will have to figure out on what elements to click, and how to identify these.

        Again, I recommend using the RSS and/or ical interfaces instead. They are geared for consumption by machines such as smartphones.

        How about you do that?