This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-10-19 15:51:10

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

I could use some help with webpage reading...

Hey guys, simple question... I wish  tongue

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)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#2 2010-10-19 16:13:39

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: I could use some help with webpage reading...

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!


You can now reach me on Twitter @johnnydean1_

Offline

 

#3 2010-10-19 16:29:20

Daffy22
Scratcher
Registered: 2008-12-15
Posts: 500+

Re: I could use some help with webpage reading...

were did nXIII post that?? That would be really useful!  big_smile


http://img201.imageshack.us/img201/1784/logosmalle.png
"Spectacular - 5 Star" -  CNET.com Editor.

Offline

 

#4 2010-10-19 16:31:36

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: I could use some help with webpage reading...

I cant remeber where he posted it but I think I have got the code


You can now reach me on Twitter @johnnydean1_

Offline

 

#5 2010-10-19 16:32:40

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: I could use some help with webpage reading...

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.


You can now reach me on Twitter @johnnydean1_

Offline

 

#6 2010-10-19 16:36:57

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: I could use some help with webpage reading...

how did you find it that fast? I had to search for ages!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#7 2010-10-19 16:49:22

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: I could use some help with webpage reading...

Oh I already had a copy!


You can now reach me on Twitter @johnnydean1_

Offline

 

#8 2010-10-19 16:50:52

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: I could use some help with webpage reading...

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)


You can now reach me on Twitter @johnnydean1_

Offline

 

#9 2010-10-20 02:47:46

Kidkac
New Scratcher
Registered: 2010-10-20
Posts: 1

Re: I could use some help with webpage reading...

well I wrote an article about it here. http://www.squidoo.com/how-can-i-read-better

Offline

 

#10 2010-10-20 02:48:05

Daffy22
Scratcher
Registered: 2008-12-15
Posts: 500+

Re: I could use some help with webpage reading...

johnnydean1 wrote:

Oh, in future check with me if you cant find a block/want a block. I may already have it!
here!

Thanks!  big_smile


http://img201.imageshack.us/img201/1784/logosmalle.png
"Spectacular - 5 Star" -  CNET.com Editor.

Offline

 

#11 2010-10-20 02:54:42

Daffy22
Scratcher
Registered: 2008-12-15
Posts: 500+

Re: I could use some help with webpage reading...

Maybe if you just make a 'browser' after all. Thats what people are trying to do.  hmm
Then not just google would work but all websites would work!  big_smile


http://img201.imageshack.us/img201/1784/logosmalle.png
"Spectacular - 5 Star" -  CNET.com Editor.

Offline

 

#12 2010-10-20 14:37:33

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: I could use some help with webpage reading...

Kidkac wrote:

well I wrote an article about it here. http://www.squidoo.com/how-can-i-read-better

*cough* spam!! *cough*


You can now reach me on Twitter @johnnydean1_

Offline

 

#13 2010-10-21 05:01:41

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: I could use some help with webpage reading...

erm... I thought I'd just start with google images as a tester, I don't really have the time to make a full on browser.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

Board footer