def search(name,browser): global i #nm='' #for n in name: # if n==' ': # nm+='%' # else: # nm+=n profiles_list=[] iit=' Indian Institute of Technology, Kharagpur' link="https://www.quora.com/search?q="+name+iit+"&type=profile" time.sleep(1) for profile in quora_scrape.get_quora_data(link,browser): '''print profile profiles={} data=[] profiles['quora']=profile if('about' in profile): name=profile['about'] if(contains(name,'IITM') or contains(name,'Madras')):''' i=i+1 stdinfo=str(i)+'.json' with open(stdinfo,'w') as f: #json.dump(profile,f) f.write(profile) return profiles_list
def search(name, browser): global i #nm='' #for n in name: # if n==' ': # nm+='%' # else: # nm+=n profiles_list = [] iit = ' Indian Institute of Technology, Kharagpur' link = "https://www.quora.com/search?q=" + name + iit + "&type=profile" time.sleep(1) for profile in quora_scrape.get_quora_data(link, browser): '''print profile profiles={} data=[] profiles['quora']=profile if('about' in profile): name=profile['about'] if(contains(name,'IITM') or contains(name,'Madras')):''' i = i + 1 stdinfo = str(i) + '.json' with open(stdinfo, 'w') as f: #json.dump(profile,f) f.write(profile) return profiles_list
def search(name,browser): global j global i j+=1 if j<=847+1453+5613: return [] profiles_list=[] iit=' Indian Institute of Technology, Madras' link="https://www.quora.com/search?q="+name+iit+"&type=profile" time.sleep(1) for profile in quora_scrape.get_quora_data(link,browser): i=i+1 stdinfo=str(i)+'.json' with open(stdinfo,'w') as f: f.write(profile) return profiles_list
def search(name, browser): global j global i j += 1 if j <= 396 + 73 + 818 + 1296: return [] profiles_list = [] iit = ' Birla Institute of Technology and Science, Pilani' link = "https://www.quora.com/search?q=" + name + iit + "&type=profile" time.sleep(1) for profile in quora_scrape.get_quora_data(link, browser): i = i + 1 stdinfo = str(i) + '.json' with open(stdinfo, 'w') as f: f.write(profile) return profiles_list
def search(name,dept,browser): global j global i global flag if name==name0: flag=1 if flag==0: return [] profiles_list=[] inst=' '+insti link="https://www.quora.com/search?q="+name+inst+"&type=profile" time.sleep(0.8) for profile in quora_scrape.get_quora_data(link,dept,browser): i=i+1 stdinfo=str(i)+'.json' with open(stdinfo,'w') as f: f.write(profile) return profiles_list
def search(name,dept,browser): global j global i global flag j+=1 '''if j<=237+469+91+741+119: return []''' if name=='Abhra Sarkar': flag=1 if flag==0: return [] profiles_list=[] iit=' Indian Institute of Technology, Guwahati' link="https://www.quora.com/search?q="+name+iit+"&type=profile" time.sleep(0.8) for profile in quora_scrape.get_quora_data(link,dept,browser): i=i+1 stdinfo=str(i)+'.json' with open(stdinfo,'w') as f: f.write(profile) return profiles_list
import time import quora_scrape from selenium import webdriver insti=raw_input("enter institute name without errors: ") link="https://www.quora.com/search?q="+insti+"&type=profile" i=int(raw_input("enter last file no.(or 0) ")) dept=raw_input('enter dept(or NA) ') browser=webdriver.Chrome() login = raw_input('Logged in to Quora? ') if login=='y': browser.get(link) quora_scrape.get_quora_data(link,dept,browser,i)