Created
September 30, 2011 23:14
-
-
Save sahib/1255277 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './glyros.so' | |
include Glyros | |
# Simple example on how to directly call a certain | |
# provider's get_url() and parser() function. | |
# We need a query (as usual) | |
q = GlyrQuery.new | |
glyr_query_init(q) | |
glyr_opt_artist(q,"Equilibrium") | |
# Ask the photo:picsearch provider where it looks for data. | |
url = glyr_testing_call_url("picsearch",GLYR_GET_ARTIST_PHOTOS,q) | |
# Download the pagesource of this url. | |
page_source = glyr_download(url,q) | |
# Now run photo:picsearch's parser on it. It will return (similar to glyr_get()) a linked list | |
# of caches. Note: Actually it does something different, but it gets converted to a linked list :-) | |
list = glyr_testing_call_parser("picsearch",GLYR_GET_ARTIST_PHOTOS,q,page_source) | |
# Iterate over all results to demonstrate it | |
# Set glyr_opt_number to e.g. 5 to get more of it. | |
# In this cases you'll just get urls, no read images. | |
head = list | |
until head.nil? | |
glyr_cache_print(head) | |
head = head.next | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment