Search Providers are defined in the Configuration.xml file in the <sources /> section. A source is defined by adding a <source /> element, then specifying the type of the source with the xsi:type attribute.

To Create a custom regular expression search source you need to set the type to RegexBasedSearchSource

The RegexBasedSearchSource element has 4 child elements:

Name Description Type
base The root url of the request string
url The path and query string of the request. use {0} to represent the title and {1} to represent the value in the search type string
pattern The regular expression to locate the image url. The image url needs to be the first capture. string
referer The url to send as the referering url string

Example

<source xsi:type="RegexBasedSearchSource">
  <base>http://images.someimagesearch.com/</base>
  <url>search.aspx?s={0}+{1}</url>
  <pattern><![CDATA[
    <div [^>]* class="results"> \s* <img [^>]* class="result" [^>]* src="([^"]*)"
  ]]></pattern>
  <referer>http://images.someimagesearch.com/</referer>
</source>

Last edited Apr 5, 2008 at 5:02 PM by camalot, version 1

Comments

No comments yet.