#1 2007-05-09 19:58:44

MaTiZ
New member
Registered: 2007-04-29
Posts: 4

Tips needed for plugin creation (POST, notags)

Hi all,

First of all, thanks for creating this nice piece of software. Just what i was looking for.
I am in the process of creating a plugin for the Dutch movie site http://www.moviemeter.nl, but ran into some difficulties. The search form on the website is using POST to transmit data, instead of the widely used GET. I think the plugin is focused on the GET method, at least i don't see how to get it working woth POST. Please tell me if it is possible.
Fortunately, i found a way on the way to use GET on that website. It is a bit a backdoor strategy, but it works in two steps. The search bar uses an AJAX call to serve information through a script that does a GET call smile like this: http://moviemeter.nl/calls/quicksearch. … 614e7985c5
Which returns:
film;;39471;;The Boss of It All %28Direkt%F8ren for det Hele%29 %282006%29
This gives us an ID for the movie (Direktoren for det hele in this case), which leads to the movie information page: http://moviemeter.nl/film/39471

I am facing two problems with this strategy:
1) The quicksearch.php script needs a hash which can be found if you look at the source of the main page (moviemeter.nl), but changes over time. So a two step procedure is needed for the plugin (eg get a hash and do search)
2) The search results are not shown as a html page but as plain text (see above), so the parsing in the plugin script is not working, because the information is not inside a tag.

I hope someone can give me some tips for creating this plugin, because moviemeter.nl is the best and most up-to-date Dutch movie site.

Thanks,

MaTiZ

Offline

 

#2 2007-05-10 07:07:42

Tian
Administrator
From: France
Registered: 2006-12-08
Posts: 1647
Website

Re: Tips needed for plugin creation (POST, notags)

Hello,

It is possible to use POST for searches. It is undocumented for the moment, but I will add this ASAP to the wiki page about plugins creation.

The method getSearchUrl of your plugin could return a list of values instead of only the URL. If it returns a list, it is made of:

(url, reference to an array of key values).

The 1st item is as previously the url of the search form.

The 2nd one is an array reference. This array is made of successions of keys and values corresponding to all the parameters. You may find an example in lib/gcstar/GCPlugins/GCstar/GCAmazonCommon.pm

The getSearchUrl method returns in this example:

Code:

return ('http://s1.amazon.'.$self->{suffix}.'/exec/varzea/sdp/sai-condition/', ['sdp-sai-asin' => $code])

You may have more than one value for the form. Then the 2nd parameter would look like:

Code:

['param1' => 'value1', 'param2' => 'value2', 'param3' => 'value3']

If you also want to parse some plain text instead of HTML code, you may override the parse method in your class. It will be called with the full text content of the page. You have an example in lib/gcstar/GCPlugins/GCmusics/GCMusicBrainz.pm

Here, we don't parse the page with an HTML parser, but we create an XML parser to do the job.

I hope I answered your questions. Thank you for your interest in this application.
lib/gcstar/GCPlugins/GCmusics/GCMusicBrainz.pm

Offline

 



Should you have a problem using GCstar, you can open a bug report or request some support on GCstar forums.