How can I make a Quora.com BOT?
2017-09-22, 02:57 PM,
#11
Personally, I'd try Golang it's very easy to learn and very powerful. You can take a look at golang.org
Reply
2017-09-22, 04:26 PM, (This post was last modified: 2017-10-20, 05:16 PM by Kjartansson.)
#12
Here is some code for a python bot of quora, maybe you can use it for something :)


Code:
#all cats are yellow
from selenium import webdriver
from bs4 import BeautifulSoup
import time


#Quora Login Information
email=""
passy=""

# File With Questions Here
filey = ""

#Read File ,strip new lines ,return question list
def readFile(filey):
   with open(filey, "r") as f:
       q = f.readlines()
   qlist = [x.strip() for x in q]
   # qlist=reversed(qlist) #Will reverse the question list if needed
   print len(qlist), "Total Questions Loaded"
   return qlist

#Login to Quora
def login(email, passy):
   print "Logging in..."
   driver.get("http://quora.com")

   # Create Soup Object and find all form_column classes
   forms = BeautifulSoup(driver.page_source, "lxml").find_all(class_="form_column")

   # Iterate through forms
   # Find polymorphic id string,append a hashtag(#) to create css_selector
   for form in forms:
       try:
           # This is for email/password entry box
           data = form.find("input")["name"]
           if data == "email":
               email_css = "#" + form.find("input")["id"]
           if data == "password":
               password_css = "#" + form.find("input")["id"]
       except:
           pass

       try:
           # This is for the Login Button
           data = form.find("input")["value"]
           if data == "Login":
               button_css = "#" + form.find("input")["id"]
       except:
           pass

   driver.find_element_by_css_selector(email_css).send_keys(email)
   driver.find_element_by_css_selector(password_css).send_keys(passy)
   time.sleep(2)
   driver.find_element_by_css_selector(button_css).click()
   time.sleep(2)
   # LOGIN FINISHED


#Create Question List
qlist = readFile(filey)

#Create Webdriver Vroom Vroom
driver = webdriver.Chrome()

#Total Questions Posted Counter
county=0

# Iterate through qlist ask questions till no more
for question in qlist:
   try:
       print question
       driver.get("http://quora.com")
       soup=BeautifulSoup(driver.page_source,"lxml")

       # Find all text areas
       blox = soup.find_all("textarea")

       # Find polymorphic id string for Ask Question entry field
       for x in blox:
           try:
               placeholder = x["placeholder"]
               if placeholder.__contains__("Ask or Search Quora"): # Fix this later
                   askbar_css = "#" + x["id"]
                   print askbar_css
           except:
               pass


       askbutton = "#" + soup.find(class_="AskQuestionButton")["id"]# Fix this later

       # Type out Question
       driver.find_element_by_css_selector(askbar_css).send_keys(question)

       # Wait for askbutton to become clickable
       time.sleep(.2) # Fix later
       try:
           driver.find_element_by_css_selector(askbutton).click()
       except:
           #Click Failed # Fix later
           pass

       # Find the popup
       while True:
           try:
               soup = BeautifulSoup(driver.page_source, "lxml")
               popExists = soup.find(class_="Modal AskQuestionModal")
               break
           except:
               pass
       soup = BeautifulSoup(driver.page_source,"lxml")
       popup = "#" + soup.find(class_="submit_button modal_action")["id"]
       driver.find_element_by_css_selector(popup).click()

       for x in range(0,17):
           time.sleep(.1)
           try:
               soup = BeautifulSoup(driver.page_source, "lxml")
               popExists = soup.find(class_="PMsgContainer") #Found Popup

               if str(popExists).__contains__("You asked"): #big no no
                   county += 1
                   break
           except:
               pass
       print "county=>",county


   except Exception,e:
       print e
       print "ERROR"
       pass
Reply
2017-10-20, 04:44 PM,
#13
I suggest you use c#. You have a lot of tools that will make bot coding easy. Use SQLite database to store accounts. You can grab data from SQLite by EntityFramework. RestSharp will take care of requests, newtonsoft.json is about parsing json and htmlagilitypack will parse html. You can also create nice looking grid with all informations using ObjectListView. I am making vote bots, web bots etc. for years and I use theese tools the most.

]int a[/code]
(2017-09-22, 04:26 PM)Kjartansson Wrote: Here is some code for a python bot of quora, maybe you can use it for something :)

#all cats are yellow
from selenium import webdriver
from bs4 import BeautifulSoup
import time


#Quora Login Information
email=""
passy=""

# File With Questions Here
filey = ""

#Read File ,strip new lines ,return question list
def readFile(filey):
with open(filey, "r") as f:
q = f.readlines()
qlist = [x.strip() for x in q]
# qlist=reversed(qlist) #Will reverse the question list if needed
print len(qlist), "Total Questions Loaded"
return qlist

#Login to Quora
def login(email, passy):
print "Logging in..."
driver.get("http://quora.com")

# Create Soup Object and find all form_column classes
forms = BeautifulSoup(driver.page_source, "lxml").find_all(class_="form_column")

# Iterate through forms
# Find polymorphic id string,append a hashtag(#) to create css_selector
for form in forms:
try:
# This is for email/password entry box
data = form.find("input")["name"]
if data == "email":
email_css = "#" + form.find("input")["id"]
if data == "password":
password_css = "#" + form.find("input")["id"]
except:
pass

try:
# This is for the Login Button
data = form.find("input")["value"]
if data == "Login":
button_css = "#" + form.find("input")["id"]
except:
pass

driver.find_element_by_css_selector(email_css).send_keys(email)
driver.find_element_by_css_selector(password_css).send_keys(passy)
time.sleep(2)
driver.find_element_by_css_selector(button_css).click()
time.sleep(2)
# LOGIN FINISHED


#Create Question List
qlist = readFile(filey)

#Create Webdriver Vroom Vroom
driver = webdriver.Chrome()

#Total Questions Posted Counter
county=0

# Iterate through qlist ask questions till no more
for question in qlist:
try:
print question
driver.get("http://quora.com")
soup=BeautifulSoup(driver.page_source,"lxml")

# Find all text areas
blox = soup.find_all("textarea")

# Find polymorphic id string for Ask Question entry field
for x in blox:
try:
placeholder = x["placeholder"]
if placeholder.__contains__("Ask or Search Quora"): # Fix this later
askbar_css = "#" + x["id"]
print askbar_css
except:
pass


askbutton = "#" + soup.find(class_="AskQuestionButton")["id"]# Fix this later

# Type out Question
driver.find_element_by_css_selector(askbar_css).send_keys(question)

# Wait for askbutton to become clickable
time.sleep(.2) # Fix later
try:
driver.find_element_by_css_selector(askbutton).click()
except:
#Click Failed # Fix later
pass

# Find the popup
while True:
try:
soup = BeautifulSoup(driver.page_source, "lxml")
popExists = soup.find(class_="Modal AskQuestionModal")
break
except:
pass
soup = BeautifulSoup(driver.page_source,"lxml")
popup = "#" + soup.find(class_="submit_button modal_action")["id"]
driver.find_element_by_css_selector(popup).click()

for x in range(0,17):
time.sleep(.1)
try:
soup = BeautifulSoup(driver.page_source, "lxml")
popExists = soup.find(class_="PMsgContainer") #Found Popup

if str(popExists).__contains__("You asked"): #big no no
county += 1
break
except:
pass
print "county=>",county


except Exception,e:
print e
print "ERROR"
pass

For god sake start using bbcodes.
Reply


Related Threads
Thread Author Replies Views Last Post
  So You Want to Build a Ch@t Bot – Here's How (Complete with Code!) SwiffJustus 0 390 2017-10-05, 09:56 AM
Last Post: SwiffJustus
  I will try to code a bot for you for FREE blacksploit 30 2,727 2017-09-02, 11:49 PM
Last Post: blacksploit
  Im a programmer, i can make mobile landings pwnisher 2 410 2017-07-28, 09:16 AM
Last Post: Pachu
  How to make step content in website 5light 0 219 2017-07-24, 11:04 AM
Last Post: 5light
  How to make this code? ngengs 7 941 2016-12-18, 09:51 PM
Last Post: bryan1





About Us | Contact Us | CPA Elites | Advertise | Stats | Staff Team

© 2013-2018 CPA Elites Ltd
Enhanced by MyBB and WallBB
Return to top