PPF Home
Plugins
Developers
   Font size:      

HTML2IRC (v0.1a)

PDF
PDF

Description

Here's a nifty and powerful plugin for the Pircbot Plugin Framework (PPF) for you. The plugin enables loading html-content to irc very fast. You are able to configure which parts of the HTML should be output into irc.

This plugin is very powerful and should replace all further instances of plugins which only read from html sites and output some content in the channel like the googlePlugin, filemirrorPlugin, bash, nanoGoogle, nanoBash and nanoTorrent. It's a perfect addition to the feedReader plugin, now having the ultimate powertools to work with xml and html.

Please Note: the author of the plugin takes no responsibility on any harm or violation the users do by using the plugin. Do not access/read sites which do not explicitly allow so or without the permission of the respective webmasters!

Configuration

The configuration file for this plugin is system/html2irc/html2ircConfig.xml

Adding New Commands

You add a command by modifying the html2ircConfig.xml file. You need to know how to form proper regular expressions in java or else you don't have to continue reading. Here�s the basic code snippet for new commands:


<command message="regex" authLevel="none|any|admin|master|trusted|none" output="channel|notice|pm">
      <href>URI</href>
      <regex><![CDATA[your regular expression here]]></regex>
      <output reapeat="true|false" count="[1-9]" striphtml="true|false">output string</output> 
</command>

    

Here is an example of the plugin retrieving 3 results from www.google.com :


<command message="!google (.*)" authLevel="none" output="channel">
          <href>http://www.google.com/search?q=$1</href>
          <regex><![CDATA[<a class=l href=\"([^\"]*)\">(.*?)</a>]]]></regex>
          <output repeat="true" count="3" striphtml="true">(google) $2 ( $BLUE$1$NORMAL )</output>
</command>

    

Notes

  • if you want to use HTML tags (’<’,'>’,'&’) in the output code, please make sure you convert them to entities (’&lt;’,&gt;’,'&amp;’)
  • you can backreference with $1 $2 $3 $4 (href backreferences to message attribute, output backreferences to regex)
  • you can show current index number of output with $INDEX (repeat="true" and count>1 only)

The following features are not completely implemented yet:

  • /command/ attribute autLevel
  • /command/ attribute output
  • /command/output/ attribute striphtml
  • /command/output/ attribute multiline

Commands

This plugin allows you to create your own commands, as described above.

Change History

v0.1a First Version by ChrisWell