The query server can be used to search a keyword/phrase on a search engine (Google, Yahoo, Bing, DuckDuckGo) and get the results as
json
orxml
. The tool also stores the searched query string in a MongoDB database for analytical purposes. (The search engine scrapper is based on the scraper at fossasia/searss.)
The API(s) provided by query-server are as follows:
GET /api/v1/search/<search-engine>?query=query&format=format
search-engine : ['google' , 'bing', 'duckduckgo' , 'yahoo']
query : query can be any string
format : [
json
,xml
]
A sample query : /api/v1/search/bing?query=fossasia&format=xml
404 Not Found : Incorrect Search Engine, Zero Response
400 Bad Request : query and/or format is not in the correct format
- Python 2.x or Python 3.x
- Node.js
- Pip
- Flask
- BeautifulSoup4
Make sure you have Nodejs installed. Running this tool requires installing the nodejs as well as python dependencies.
git clone https://github.com/fossasia/query-server.git
cd query-server
npm install -g bower
bower install
pip install -r requirements.txt
To set up MongoDB on your server :
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo service mongod start
To run the query server:
python app/server.py
Found an issue? Post it in the issue tracker
This project is currently licensed under the Apache License version 2.0. A copy of LICENSE
should be present along with the source code. To obtain the software under a different license, please contact FOSSASIA.