Hey guys, simple question... I wish
okay, so using nXIII's Panther block for importing costumes directly from the web by entering an address, I was hoping to make a google image searcher. The idea is that using search terms, I can read the image results page from the HTML, the use the "index of $String$ starting at $Number$ in $String$" block to then locate the <img= and src=" opening tags and the " and > closing tags. This would work great, except that google does not seem to use the traditional <img> tags, nor does it seem to have a link to the actual image, meaning that the correct image locations for each thumbnail can't be found.
so, I can ask for a search term, convert it to the correct google format, then read the html for that page. Then I get stuck. Any ideas?
Thanks, Sparks
EDIT: here's the script I'm using, if it helps. The repeat 10 with the space waits is just for me to see what results it gets. http://img840.imageshack.us/img840/5720/74055893.gif
and yes, the (letters 1 - 7 of image) shouldn't be there, I know. That's not the cause
Last edited by sparks (2010-10-19 15:56:43)
Offline
Thats very complex, this is what I think. When you do a google search it makes 2 web pages. You see 1 (the one you get). That page gives refrence to the 2nd one which contains all the images. Therefore you get no image tags!
Offline
I cant remeber where he posted it but I think I have got the code
Offline
Make costume from $String$
Type: -
|url img newC |
url_ t1.
(url asLowercase endsWith: '.gif') ifTrue: [
img _ (GIFReadWriter new setStream: (HTTPSocket httpGet: url)) nextImage.]
ifFalse: [
(url asLowercase endsWith: '.png') ifTrue: [
img _ (PNGReadWriter createAFormFrom: (HTTPSocket httpGet: url) contents) first]
ifFalse: [
img _ HTTPSocket httpJpeg: url]].
newC _ ImageMedia new form: img; mediaName: (self unusedMediaNameFromBaseName: (self defaultImageMedia mediaName)).
self addMediaItem: newC.
Offline
Oh I already had a copy!
Offline
Oh, in future check with me if you cant find a block/want a block. I may already have it!
here!
Last edited by johnnydean1 (2010-10-19 17:01:52)
Offline
Kidkac wrote:
well I wrote an article about it here. http://www.squidoo.com/how-can-i-read-better
*cough* spam!! *cough*
Offline