def loadallkeywords(ac):
    res = DBkeywords.getkeyword()
    for ke in res:
        try:
            url = 'https://www.bing.com/search?q=' + ke[0].replace(" ", "+")
            get_search(url, ke[0], ac)
        except Exception, e:
            print str(e)
            continue
Beispiel #2
0
			# 	WebDriverWait(browser, 20).until(EC.presence_of_element_located(browser.find_element_by_xpath("*/body")))
			# 	print "Page is ready!"
			# except TimeoutException:
			# 	print "Loading took too much time!"
			time.sleep(30)
			body = browser.page_source
			test_DB.ask(ID[0],Tittle,further_url,abstract,body,currentdate.getdate(),ac)
		# except AttributeError:
		# 	print str('AttributeError')
		# 	test_DB.suspect('ask',-1,ID[0],further_url,3,currentdate.getdate(),'AttributeError',Tittle,abstract)
		# 	continue
		except Exception, e:
			print "caught exception :site:"+further_url +"keyword: "+keyword
			test_DB.suspect('ask',-1,ID[0],further_url,3,currentdate.getdate(),str(e),Tittle,abstract)
			print str(e)
			continue
	time.sleep(20)
	

if __name__ == "__main__":
	res = DBkeywords.getkeyword()
	li=DBkeywords.loadsunsearchedkeywords('ask')
	for ke in li:
		try:
			url = 'http://www.ask.com/web?q='+ke[0].replace(" ","+")
			print url
			get_search(url,ke[0],'FR')
		except Exception, e:
			print str(e)
			continue