topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday March 19, 2024, 1:35 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Time zone alias (with a general page scraper - could be useful for other things!  (Read 8448 times)

Jabberwock

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 76
    • View Profile
    • Donate to Member
As the unit converter alias was quite handy, I have decided to look into time zone reporting utility.

Unfortunately, there was no command line utility which I could use for that purpose, although there were quite a few sites with that info... Then I got the idea: how about a general scraper that would get that info?

I've found this utility:

http://www.webscrape.com/

With this getting an alias was trivial:

1000>>>time>->showmemo Time in $$1:;;;appcapappendmemo C:\Program Files\Internet\PageScrape\pscrape.exe -uhttp://www.timeanddate.com/worldclock/results.html?query=$$u1 -e"Current Time.*big>(.*)<">+>time in (.*)

(BTW, how to display the result in a nice format while typing? For now I see the url, which is rather ugly looking...)


However, the potential for this is much greater. Considering that the utility does multiple matching, you can get custom searches, various lookups etc. The page itself lists weather, exchange rates, spelling and thesaurus...

EDIT: Changed the parameter to be URL friendly...
« Last Edit: July 19, 2010, 08:17 PM by Jabberwock »

Perry Mowbray

  • N.A.N.Y. Organizer
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 1,817
    • View Profile
    • Donate to Member
That's a nice find...

I use WebMetaSearch that does that in FARR, and of course FARRTimeZone... but I can think of other good uses to put that to instead of doing it by hand...

Jabberwock

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 76
    • View Profile
    • Donate to Member
I've missed FARR TimeZone, as it's not listed in the update app... I don't mind at all though, as this made me find the scraper. :)


Perry Mowbray

  • N.A.N.Y. Organizer
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 1,817
    • View Profile
    • Donate to Member
Have you had a look at FARR plugin: FarrWebMetaSearch 1.6.0? It's also a powerful scraper with the ability to display as you type (amongst other things)... a little different to what your alias is doing.

No, I agree about the scraper: it's a great find!! ...and your alias is great too!  :Thmbsup:

Jabberwock

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 76
    • View Profile
    • Donate to Member
From reading the topic I was under impression that WMS does only predefined searches...  :o Still, it works a bit different, so maybe the scraper will still be useful for someone.

Perry Mowbray

  • N.A.N.Y. Organizer
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 1,817
    • View Profile
    • Donate to Member
The scraper will definitely be useful! Thanks for finding it: it's great.  :Thmbsup:

You can write your own WMS searches. I've done a few, as have others here on DC. It's great when your scraping search results, as it gives you an interactive functionality.

I think your alias is perfect for situations where you want the scrape the same thing, or you're not looking for a range of results. Yes? I'm not sure as I have not played with it, but I can imagine some very useful uses.

Jabberwock

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 76
    • View Profile
    • Donate to Member
In fact, there is not that much difference: the scraper can do lists of results as well (with the -m) switch and WMS can do one-shot searches, of course. WMS has definitely better formatting (as it uses internal FARR formats), the scraper might be better for longer pieces of text (with the -f option).

Here is another example (for Urban Dictionary):

1000>>>urban>->showmemo Urban Dictionary definitions for $$1:;;;appcapappendmemo C:\Program Files\Internet\PageScrape\pscrape.exe -uhttp://www.urbandictionary.com/define.php?term=$$u1 -e"class=.index.*[0-9].>(.*)<.a>.*word.>(.*)<.*definition.>(.*)<.*example.>(.*)<" -m -f"\n\$1 \$2Definition: \$3\nExample: \$4">+>urban (.*)

It is not that pretty, probably the regex could be better. However, I do not think FARR allows formatting in the results window (after all, it was not meant for such things), so it will be a bit hard to read.