Jump to content
Ketarin forum

Ketarin to Ketamon!


Omniferum
 Share

Recommended Posts

I decided to take a shot at what I suggested to floele earlier with trying to get Ketarin to check for web page updates. Found an alternative (Page Update Watcher on sourceforge) however I still like the options Ketarin gives.

 

So here you go, I thought i'd make such a template for the community more to show off Ketarin can do things like this.

 

So below is a template that will only ask you for the web page you want to monitor, if it changes AT ALL it will load the page with your default browser.

 

If you want it to monitor a specific part of a webpage you can edit the regex in the {monitor} variable, or just change it to start/end text mode. You will most likely want to do this as all modern pages have lots of changing data that isn't relevant to actual page content. Ads/random images etc. The only regex you'll really need is

 

firstwordyawant.*?secondwordyawant

 

Example

 

<h1>.*?</h1>

Pants.*?weee

 

This template assigns the name automatically to the name of the page, if you see strange characters it is because it captures HTML encoding for special characters. So the trademark symbol would appear to be ™

 

It works perfectly fine, the only issue is that you will have to run 'update' everytime you want to check to see if something is different as Ketarin has no internal scheduler. However there are plenty of third party task schedulers you could use or manually use a hotkey/shortcut to run it when you want. I just keep a second ketarin with a blank file called jobs.db in its folder (to make it portable/independent) and put all the pages you want to monitor in that separate ketarin and run that Ketarin with the /silent command line switch.

 

Alternatively if you just want to use one ketarin install you can just create a blank file called ketamon.db in your current ketarin folder and run ketarin /database=ketamon.db. Running your ketarin normally will load the default jobs.db.

 

The fixed url is https://www.google.c...s/mail_logo.png purely because Ketarin needs a valid url to download, I picked that purely because google is hardly going to go down really and I doubt that URL is going to change anytime soon. However if it does just pick anything that is a valid file you could download. It doesn't really matter what it is, Ketarin won't actually download it.

 

<?xml version="1.0" encoding="utf-8"?>
<Jobs>
 <ApplicationJob xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <WebsiteUrl>{page}</WebsiteUrl>
   <IgnoreFileInformation>true</IgnoreFileInformation>
   <DownloadBeta>Default</DownloadBeta>
   <CheckForUpdatesOnly>false</CheckForUpdatesOnly>
   <VariableChangeIndicator>monitor</VariableChangeIndicator>
   <CanBeShared>true</CanBeShared>
   <ShareApplication>false</ShareApplication>
   <ExclusiveDownload>false</ExclusiveDownload>
   <HttpReferer />
   <SetupInstructions />
   <Variables>
  <item>
    <key>
	  <string>monitor</string>
    </key>
    <value>
	  <UrlVariable>
	    <RegexRightToLeft>false</RegexRightToLeft>
	    <VariableType>RegularExpression</VariableType>
	    <Regex>.*</Regex>
	    <Url>{page}</Url>
	    <Name>monitor</Name>
	  </UrlVariable>
    </value>
  </item>
      <item>
    <key>
	  <string>name</string>
    </key>
    <value>
	  <UrlVariable>
	    <RegexRightToLeft>false</RegexRightToLeft>
	    <VariableType>RegularExpression</VariableType>
	    <Regex><title>.*?(\S.*?)\s*</title></Regex>
	    <Url>{page}</Url>
	    <Name>name</Name>
	  </UrlVariable>
    </value>
  </item>
     <item>
    <key>
	  <string>page</string>
    </key>
    <value>
	  <UrlVariable>
	    <RegexRightToLeft>false</RegexRightToLeft>
	    <VariableType>Textual</VariableType>
	    <Regex />
	    <TextualContent><placeholder name="URL" /></TextualContent>
	    <Name>page</Name>
	  </UrlVariable>
    </value>
  </item>
   </Variables>
   <ExecuteCommand />
   <ExecutePreCommand>start "" "{page}" & exit 3</ExecutePreCommand>
   <ExecuteCommandType>Batch</ExecuteCommandType>
   <ExecutePreCommandType>Batch</ExecutePreCommandType>
   <Category>Web Page Monitoring</Category>
   <SourceType>FixedUrl</SourceType>
   <PreviousLocation />
   <DeletePreviousFile>true</DeletePreviousFile>
   <Enabled>true</Enabled>
   <FileHippoId />
   <TargetPath>Web Page Monitoring\{appname:regexreplace:([^a-zA-Z0-9\_]+):-}</TargetPath>
   <FixedDownloadUrl>https://www.google.com/images/logos/mail_logo.png</FixedDownloadUrl>
   <Name><placeholder name="Name of application" variable="name" /></Name>
 </ApplicationJob>
</Jobs>

 

EDIT

 

1. Added a page variable

2. The "stuck variable" problem was fixed in Ketarin 1.6 beta 6, everything works perfectly now

3. Added exit code 3, introduced in Ketarin 1.6.1 beta 2. Will now provide a timestamp if a page change happens

Edited by Omniferum
Link to comment
Share on other sites

  • 1 month later...

Some basic tips are HTML header tags. If we are monitoring pages usually we only want either an increased post count for forums or new headers for web pages for big/small news.

 

<h1>.*?</h1>

<h2>.*?</h2>

<h3>.*?</h3>

 

However you can use the following regex to find h followed by any number.

<h\d>.*?</h\d>

 

 

Those are basic regex to capture header tags that is the big text you see on web pages saying "10 people die in car crash!" or something along those lines.

 

In general the only regex you'll really want is

 

.*?

 

put what you want it to start with beforehand and what you want it to end at at the end. I haven't found a need for any other kind of regex so far. If you have a few words it needs to find sequentially just repeat the .*?

 

like.*?ponies.*?exploding

 

For example the regex I use for monitoring the Ketarin forum to see if there are new posts is.

 

EDITED FOR KETARINS NEW FORUM LAYOUT (15/10/2011)

<span class='value'>(.*?)<

Link to comment
Share on other sites

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.