I am writing a script which involves showing the user a webpage on the basis of his requirements (which I take as inputs) and opening it in firefox. For instance, a crude version of this is :
#!/bin/bash
read -p "What do you want to search" search_term
link=$(echo "http://www.mywebsite_whatever.com/search?q="$search_term)
firefox $link
The major problem is I cannot wget/urllib this website since I don’t have permission.
Now what I want to do is :
Have the user look over only certain keywords on the webpage. So for that I want to either:
-
Open firefox with the
findbox (Ctrl + F) ON with the keyword in it (without changing the source code of firefox) -
Somehow have firefox open the website, save it as html and quit. (I can’t wget) Then I can
grepout keywords as desired. [Please don’t start off on how this is unethical and all. I am doing this merely as an exercise]
I am working on Linux.
Use Wget with the
--user-agentswitch so that the website thinks you’re using Firefox, for exampleOf course, for a permanent script you should instead use
--user-agent="MyScript/1.0 (http://mywebsite/)"or similar so that if it goes haywire they know who to contact.