I am using this API from Stands4 to get quotes. I was able to build my random quote generator for free code camp using their RANDOM tag in the request. Now I want to know how to write a request to get quote from a tv show for a personal project I am working on. Does anyone know how this is possible?
Here is the API doc: Link
In particular I am looking at the second and third lines of their Request parameters table. I want to use 'SEARCH' but don't know how to produce the correct 'query'. Maybe I am going about this wrong.
Here is the show I would like to get quotes from: Link
Here is what I tried. Goal is to get a random quote from the show.
http://www.stands4.com/services/v2/quotes.php?uid=MYUID&tokenid=MYTOKENID&searchtype=RANDOM&SEARCH&query=Its+Always+Sunny+In+Philadelphia
答案 0 :(得分:0)
Unfortunately, these aren't the greatest docs so you'll have to play around with the "query=" part of your search. You're correct in thinking that's where to start.
Here's the approach I would take to make this work:
1. Searchtype=Search: I would start subbing in all sorts of different things from It's always Sunny and seeing what gets returned, including: character names, the show name, writer/actor names, and if all else fails show objects ("Paddy's pub" and "Day man") come to mind. Note: for things with spaces make sure you're using url-encoding.
2. Searchtype=Author: Take writer names and maybe character names to see if putting those in with an author search type returns anything.
3. Use their Scripts API: I'd hope something would come from that, but if it doesn't work, you can always try and find some scripts from their Scripts API and parse them.
If all else fails you can use a scraping tool like Import.io and grab quotes from a site like IMDB. Import.io is free and very easy to use.