View Single Post
Old 02-06-2011, 08:06 PM   #11
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Quote:
Originally Posted by Loosheesh View Post
Thanks for this plugin - I added it and everything is working fine. I would like to add a couple of other search sites (FictionDB and FictFact especially) and don't know how to generate the correct url that will launch a search for a particular title/author etc. Is there a way to get this for any website? Thanks in advance
FictFact is no problem. Download the zip attachment with this post, rename the .zip to .stip extension, and then use the "Import" right-click from the plugin configuration dialog.

FictionDB on the other hand is a problem. From my quick testing they don't seem to support querystring URLs, only those supplied via it's own webpages via HTTP POST. So for instance this query below contains all of the "right data" to do an author search for Lee Child, but being in the URL rather than hidden inside the request body (as is the case when you click the submit button on their website) is still not enough to get the desired result, as it will not be an HTTP POST submission when effectively typed into a browser location url field:
http://www.fictiondb.com/search/sear...htxt=lee+child

The closest you can get imho is to just create an entry in your menu of "FictionDB", put the url below and manually type in the author/title on the search page when you use it. Well unless someone else finds a way for this website
http://www.fictiondb.com/search/searchresults.htm

In terms of a general "how do you do it", my approach is to use the search box on the website, then look at the url displayed for the page it takes you to with a smaple search. For most websites that is sufficiently useful. You then substitute in the special token values like {author} where you see the things you searched for and you now have a reusable url you can add to your plugin configuration. Do the various combinations of author, title searches etc to see what differs and job done.

For some websites through they do not display a useful url to you - they hide that search data and display a URL based on data in their database rather than what you typed in (like a numeric id representing the book/author). In that scenario I go digging on the search page using "View source page". There it should list the various special sauce variable values you need and the url that clicking search would submit to (usually with a "POST" operation). Quite often you can then take that information and construct a url to do what you need, assigning the various variable names into a querystring and the website link will work. However there is the odd site like FictionDB which is setup in such a way as to block these types of requests. It could be for instance that they do so to prevent web page scraping. In that case I believe you are a bit scuppered unless others have suggestions, I haven't done web development myself for many years.
Attached Files
File Type: zip fictfact.zip (767 Bytes, 1131 views)
kiwidude is offline   Reply With Quote