# sorry only works on one thing, and that is gorgias. LOL

# scrapes MIT's Gorgias page and lets you read blocks of text at your own speed

import requests
from bs4 import BeautifulSoup

URL = "http://classics.mit.edu/Plato/gorgias.html"

def getText(url=URL):
	print "\nGetting text ..."
	r = requests.get(URL)
	content = r.text
	soup = BeautifulSoup(content)
	text = soup.findAll("blockquote")[1].text
	text = text.replace("<a name=", "")
	text = text.replace("</a>", "")
	text = text.replace("</b>", "")
	array = text.split('\n')
	return array

def getIndexOfWordToJumpTo(textArray):
	string = raw_input("> What word did you leave off with? ")
	length = len(textArray)
	for i in range(0, length):
		if (string in textArray[i]):
			return i

	return 0

def readText(textArray):
	jumpTo = getIndexOfWordToJumpTo(textArray)
	length = len(textArray)
	for i in range(jumpTo, length):
		print textArray[i]
		print "%d / %d done" % (i, length)
		raw_input(">")

readText(getText())