The query server can be used to search a keyword/phrase on a search engine (Google, Yahoo, Bing, DuckDuckGo) and get the results as
jsonorxml. 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 : [
ask,bing,duckduckgo,yahoo]
query : query can be any string
format : [
json,xml]
A sample query : /api/v1/search/bing?query=fossasia&format=xml&num=10
404 Not Found : Incorrect Search Engine, Zero Response
400 Bad Request : query and/or format is not in the correct format
500 Internal Server Error : Server Error from Search Engine
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 startTo run the query server:
python app/server.pyFound an issue? Post it in the issue tracker For pull requests please read Open Source Developer Guide and Best Practices at FOSSASIA
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.