User avatar
diabloNL
Posts: 55
Joined: Mon Feb 26, 2007 6:08 am

Postby diabloNL » Sun Mar 11, 2007 9:40 pm

I made a plug-in that will strip the most BBCode from a feed and converts it to HTML. I made it for my own use but I thought that maybe more people can find a use for it. It works perfect for me but maybe it doesn't work for the feed you are using it for. If so, you can always edit the script and modify it to your own special needs. ;)

If there are any questions you can ask them in this topic.


Here is the link to the plug-in:

Click

User avatar
support
Site Admin
Posts: 3021
Joined: Fri Feb 07, 2003 12:48 pm
Location: Melbourne, Australia
Contact:

Postby support » Mon Mar 12, 2007 7:09 am

That's so cool. Thanks for making it available to everyone :clap:

One small suggestion: plugins sometimes have problems downloading stuff because they need cookies set or they're going through a proxy that needs authentication. It is possible to workaround these problems by getting Awasu to download the file instead of doing it yourself.

If you replace your <tt>Feed URL</tt> parameter with one called <tt>DownloadUrl</tt>, Awasu will download it for you and put it in a temp file. The path to this temp file is passed to the plugin in the config file via the <tt>DownloadUrlFile</tt> key in the <tt>[System]</tt> section. Then you just read from this local temp file instead of having to download the URL yourself. Look at the WebScrape <tt>.PLUGIN</tt> file for an example of how to set it up.

It's a good idea to also include <tt>DownloadUrl_UserName</tt> and <tt>DownloadUrl_Password</tt> parameters, in case the web page needs authentication. They won't have any effect if none is required.

For the record, a <tt>DownloadUrl_UtcOffset</tt> parameter is also recognized but the purpose of this is a bit tricky to explain :-) Some URL's that people want to monitor change according to the current date e.g. http://www.somenewssite.com/31-12-2000.html. It is possible to specify a <u>template</u> for the <tt>DownloadUrl</tt> parameter that Awasu will use to generate the real URL before downloading e.g. <tt>http://www.somenewssite.com/{%m%}-{%d%}-{%Y%}.html</tt> (the available template parameters are the same as those available for the <tt>strftime()</tt> C function). But given that you may not be living in the same timezone as the web site you want to monitor, the <tt>DownloadUrl_UtcOffset</tt> parameter lets you apply an offset to the current time (in seconds) before processing the template parameters. Phew!

User avatar
diabloNL
Posts: 55
Joined: Mon Feb 26, 2007 6:08 am

Postby diabloNL » Mon Mar 12, 2007 7:17 am

Damn! I will take a look tonight if I understand what you mean and see if I can do it. I'm not a code junky you know. :P


I normally code in VB and even then small and simpel applications. That's the reason I used the basic's from Allan B. Wilson's channelfeedencoding script.


I will see what I can do. :wink:

User avatar
support
Site Admin
Posts: 3021
Joined: Fri Feb 07, 2003 12:48 pm
Location: Melbourne, Australia
Contact:

Postby support » Mon Mar 12, 2007 8:22 am

diabloNL wrote:I normally code in VB and even then small and simpel applications.

Don't let that stop you. You can write plugins in VB as well and as you've already seen, plugins are pretty short anyway :-)

User avatar
diabloNL
Posts: 55
Joined: Mon Feb 26, 2007 6:08 am

Postby diabloNL » Mon Mar 12, 2007 8:29 am

I will try to change the feed URL to the Download URL. And to add the username and password. :anxious:

BTW: I copy/pasted the code in the wiki but the "<" and ">" characters are making a fail in Awasu. In my original file I use "&lt;" and "&gt;". But every time I paste it in the wiki he changes it to "<" and ">". :?

User avatar
support
Site Admin
Posts: 3021
Joined: Fri Feb 07, 2003 12:48 pm
Location: Melbourne, Australia
Contact:

Postby support » Mon Mar 12, 2007 10:36 am

diabloNL wrote:I copy/pasted the code in the wiki but the "<" and ">" characters are making a fail in Awasu. In my original file I use "&lt;" and "&gt;". But every time I paste it in the wiki he changes it to "<" and ">". :?

Use <tt>&amp;lt;</tt> instead of <tt>&lt;</tt>.

User avatar
diabloNL
Posts: 55
Joined: Mon Feb 26, 2007 6:08 am

Postby diabloNL » Mon Mar 12, 2007 4:32 pm

Thanks, that work. Only with "Object" and "Embed" it has to have "&amp" in the tekst. With me it otherwise doesn't work. Maybe for other websites it will but I can test it because I don't know any. :P

Anyway, it should look like this:

Code: Select all

.replace("&amp;lt;object","&lt;a href='").replace("&amp;lt;/object&amp;gt;","'&gt;&lt;/a&gt;")\
.replace("&amp;lt;embed","&lt;a href='").replace("&amp;lt;/embed&amp;gt;","'&gt;&lt;/a&gt;")\


So, can I display "&amp;lt" and "&amp;gt;" or should I let it because it depends of the feed?

I added the DownloadUrl, DownloadUrl_UserName and DownloadUrl_Password parameters. It was very easy, assuming I did it correct. I tested it and it looks ok, but I can't find the path to the temp file in the config file via the DownloadUrlFile key in the [System] section to check that.

User avatar
support
Site Admin
Posts: 3021
Joined: Fri Feb 07, 2003 12:48 pm
Location: Melbourne, Australia
Contact:

Postby support » Mon Mar 12, 2007 5:35 pm

diabloNL wrote:I can't find the path to the temp file in the config file via the DownloadUrlFile key in the [System] section to check that.

Just double-checked this and it's definitely correct.

An easy way to see what's going on is if you get your plugin to read the contents of the config file Awasu passes it and save a copy of it in another file e.g. <tt>C:\TEMP\test.ini</tt>

User avatar
diabloNL
Posts: 55
Joined: Mon Feb 26, 2007 6:08 am

Postby diabloNL » Mon Mar 12, 2007 10:44 pm

Thanks Taka. I think I will start a new project and code it in VB. I just have to try to understand how to make it work with your -great- software. :D


Return to “Awasu - Extensions”

Who is online

Users browsing this forum: No registered users and 2 guests