DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

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

Jabberwock

  • Participant
  • Joined in 2006
  • *
  • Posts: 76
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:

Code
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 20, 2010, 01:17 AM by Jabberwock »

Perry Mowbray

  • N.A.N.Y. Organizer
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 1,817
    • Participated in NANY Challenge Three Times
    • Plugin Coding Medal
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
  • *
  • Posts: 76
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
    • Participated in NANY Challenge Three Times
    • Plugin Coding Medal
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
  • *
  • Posts: 76
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
    • Participated in NANY Challenge Three Times
    • Plugin Coding Medal
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
  • *
  • Posts: 76
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.

Original address: https://www.donationcoder.com/forum/index.php?topic=23479.0