Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
dr frost maths python point farmer
import requests
from BeautifulSoup import BeautifulSoup
import dryscrape
import time
url = "http://www.drfrostmaths.com/homework/do-question.php?aaid=161230"
sess = dryscrape.Session()
sess.visit("http://www.drfrostmaths.com/homework/login.php")
name = sess.at_xpath('//*[@name="login-email"]') # Where <input name="username">
name.set("email here")
password = sess.at_xpath('//*[@name="login-password"]') # Where <input name="password">
password.set("passwd here")
# Push the button
name.form().submit()
while 1:
sess.visit(url)
time.sleep(1)
response = sess.body()
soup = BeautifulSoup(response)
question = soup.find("script", {"id": "MathJax-Element-1"}).text.encode('utf-8')
try:
question = question.replace("\\times","*")
ans = eval(question)
ans_form = sess.at_xpath('//*[@name="numeric-answer-1"]')
ans_form.set(ans)
print(question)
except:
button = sess.at_xpath('//*[@id="ma1"]')
if button !=None:
button.click()
for x in range(10):
ans_form = sess.at_xpath('//*[@name="numeric-answer-'+str(x)+'"]')
if ans_form!=None:
ans_form.set(1)
print "bad question"
sess.at_xpath('//*[@type="submit"]').click()
time.sleep(2)
@private012
Copy link

private012 commented Nov 25, 2018

h

@private012
Copy link

private012 commented Nov 25, 2018

drfrostmaths

@Adzooda
Copy link

Adzooda commented May 21, 2020

how do i use this

@max-kov
Copy link
Author

max-kov commented May 21, 2020

Sorry @Adzooda it's been 3 years since I wrote it, I've no clue what it does :(

@zkram0
Copy link

zkram0 commented May 24, 2020

Yo @AK163631, your DFM-Answer-Tool isn't working anymore, for me anyways. Can you add me on discord or something please: zkram#8784 because I need help with it asap. Thanks.

@milesbla
Copy link

milesbla commented Aug 31, 2020

Hey, how do I get added to the discord?... It doesn't work for me either... sorry I know you aren't replying @ak16...., but if you see this pls help, I have to beat the other people in my class lol.

@TheGodOfNoodles
Copy link

TheGodOfNoodles commented Oct 8, 2020

how do i use it?

@TheGodOfNoodles
Copy link

TheGodOfNoodles commented Oct 8, 2020

i download the python file then?

@felix055
Copy link

felix055 commented Feb 5, 2021

<script src="https://gist.github.com/max-kov/82a90a0c3ddce2674089327433394482.js"></script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment