Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
google searching and parsiing from cli [answered]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Thu Sep 04, 2014 7:57 am    Post subject: google searching and parsiing from cli [answered] Reply with quote

hello, I have a question, I need to search a string on a specific site as part of a script and download the first hit (if exists)

does someone knows how to do that?
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein


Last edited by DaggyStyle on Thu Sep 04, 2014 10:40 am; edited 1 time in total
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Thu Sep 04, 2014 10:39 am    Post subject: Reply with quote

to answer myself, this will extract a link from google search
Code:
wget -qO- -U 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:31.0) Gecko/20100101 Firefox/31.0' "http://www.google.com/search?q=\"bla\" site:site.com" | grep "http://site.com" | tr '"' '\n' | grep "http://site.com"

_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum