[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

mechanize & field name for search passed as string

Edouard Dantes

1/21/2009 4:47:00 AM

Hi,

I am writing a method to perform a similar to the below mentionned
google search but i want it to accept the field's name for the search
entry as a string.

In the following example from the Mechanize docs I would expect it to be
search.send('q') instead of search.q but I get this error

/scrapingGoogle.rb:14: syntax error, unexpected '=', expecting kEND
search.send('q') = 'Hello world'.

Thanks for your comments

********************************************************************

a = WWW::Mechanize.new { |agent|
agent.user_agent_alias = 'Mac Safari'
}

a.get('http://google...) do |page|
search_result = page.form_with(:name => 'f') do |search|
search.q = 'Hello world'
end.submit

search_result.links.each do |link|
puts link.text
end
end
--
Posted via http://www.ruby-....

4 Answers

Sandor Szücs

1/22/2009 10:13:00 AM

0

On 21.01.2009, at 05:46, Edouard Dantes wrote:
>
> I am writing a method to perform a similar to the below mentionned
> google search but i want it to accept the field's name for the search
> entry as a string.
>
> In the following example from the Mechanize docs I would expect it =20
> to be
> search.send('q') instead of search.q but I get this error

In the example the method which is called is not q(). It's q=3D(), so
if you want so send() then use the right method.

> ./scrapingGoogle.rb:14: syntax error, unexpected '=3D', expecting kEND
> search.send('q') =3D 'Hello world'.

search.send('q=3D', 'Hello World') or by symbol
search.send(:q=3D, 'Hello World')

regards, Sandor Sz=FCcs
--


Arthur Lipscomb

7/4/2014 5:25:00 PM

0

On 7/3/2014 2:40 PM, KalElFan wrote:
> "KalElFan" wrote in message news:c1lo56FabplU1@mid.individual.net...
>> https://www.facebook.com/ste...
>>
>> He's got 2.2 million likes on Facebook, currently has an
>> "Aim for Justice" banner atop the page, and his latest post
>> within the last 24 hours includes this:
>>
>> "You know I'm going to be at San Diego Comic-Con
>> International this year, but you have no idea what I'm
>> going to be doing. The Arrow panel on Friday evening
>> is the literal tip of the iceberg. Feel free to speculate.
>> There are (at least) 3 more things on my schedule. Big
>> things..."
>>
>> If there were Vegas odds on Warner Bros. [integrating]
>> The CW and Man of Steel Universes at SDCC, I think it
>> would be better than even money at this point. And I
>> like it. :-)
>
> Within the last hour Amell posted:
>
> "Hey Guys -- I appreciate all the support and enthusiasm,
> but not everything I post is a cryptic indicator that I'm going
> to be in Batman V Superman. I'm not going to be in Batman
> V Superman."
>

He only has himself to blame. There's only so many ways to reasonably
interpret what he said.

> This is funny. It reminds me of Jason Momoa swearing in
> an interview that he wasn't going to be Aquaman, only to
> turn out to be playing Aquaman.

I saw Jason Momoa in person a few days ago. He's still not admitting
he's playing Aquaman. And he had a pretty interesting explanation for
the trident picture.


Amell's is better because
> what he says above is almost certainly 100% the truth. I
> don't expect Green Arrow to be in Batman v Superman
> and there have been no rumors he's in it.
>
> The "already known" Flash was the Nikki rumor, and it was
> for a cameo only. The Flash is one of the Original 7 in the
> 1961 Justice League, so that'd make sense at least as a
> possibility. Amell doesn't deny he might be part of a "Big"
> announcement, or that The Flash doesn't have a cameo, just
> that he isn't in B v S.
>
> We'll know soon enough.

Anim8rFSK

7/4/2014 5:59:00 PM

0

In article <lp6o25$m9s$1@dont-email.me>,
Arthur Lipscomb <arthur@alum.calberkeley.org> wrote:

> I saw Jason Momoa in person a few days ago. He's still not admitting
> he's playing Aquaman. And he had a pretty interesting explanation for
> the trident picture.

Which is? :)

--
Wait - are you saying that ClodReamer was wrong, or lying?

Arthur Lipscomb

7/4/2014 8:51:00 PM

0

On 7/4/2014 10:58 AM, anim8rFSK wrote:
> In article <lp6o25$m9s$1@dont-email.me>,
> Arthur Lipscomb <arthur@alum.calberkeley.org> wrote:
>
>> I saw Jason Momoa in person a few days ago. He's still not admitting
>> he's playing Aquaman. And he had a pretty interesting explanation for
>> the trident picture.
>
> Which is? :)
>

I'm not going to be able to tell the story right. It started off with
something about his family/culture and mentioning the trident belonged
to his grandfather. The picture was for his grandfather.


From the same convention:

https://www.youtube.com/watch?v=W...


https://www.youtube.com/watch?v=O...


https://www.youtube.com/watch?v=v...


This turned out to be a great convention. I'm looking forward to next
year. Hopefully it will have a much better turnout.