from __future__ import print_function import os, json, sys from google import Google from duckduckgo import Duckduckgo from bing import Bing from yahoo import Yahoo scrapers = { 'g': Google(), 'b': Bing(), 'y': Yahoo(), 'd': Duckduckgo(), } def read_in(): lines = sys.stdin.readlines() return json.loads(lines[0]) def small_test(): assert type(scrapers.google.results_search('fossasia')) is list def feedgen(query, engine): urls = scrapers[engine].results_search(query) result = urls print(result) print(len(result)) return result
from duckduckgo import Duckduckgo from exalead import Exalead from google import Google from mojeek import Mojeek from parsijoo import Parsijoo from quora import Quora from yahoo import Yahoo from yandex import Yandex from youtube import Youtube scrapers = { 'ask': Ask(), 'baidu': Baidu(), 'bing': Bing(), 'dailymotion': Dailymotion(), 'duckduckgo': Duckduckgo(), 'exalead': Exalead(), 'google': Google(), 'mojeek': Mojeek(), 'parsijoo': Parsijoo(), 'quora': Quora(), 'yahoo': Yahoo(), 'yandex': Yandex(), 'youtube': Youtube() } def small_test(): assert isinstance(scrapers['google'].search('fossasia'), list)