Whelp. Shit.
Problem arose with the program.
Namely, AoOO does not like it whatsoever.
I had it set up to do all the kids, trolls, and dancestors. All of them. All 32.
It got this error:
[Shipton of pairings]
Traceback (most recent call last):
File "<pyshell#43>", line 1, in <module>
filetofics("Homestuck.txt")
File "C:/Users/Evan/Desktop/Ol' to new/Python/Programs/UrlGetter.py", line 43, in filetofics
return getallshipnum(txttolist(filename))
File "C:/Users/Evan/Desktop/Ol' to new/Python/Programs/UrlGetter.py", line 28, in getallshipnum
print namelist[i]+"/"+namelist[j]+":"+getshipnum(namelist[i],namelist[j])
File "C:/Users/Evan/Desktop/Ol' to new/Python/Programs/UrlGetter.py", line 23, in getshipnum
return getficnum(constructurl(name1,name2))
File "C:/Users/Evan/Desktop/Ol' to new/Python/Programs/UrlGetter.py", line 11, in getficnum
html=urlgetter(url)
File "C:/Users/Evan/Desktop/Ol' to new/Python/Programs/UrlGetter.py", line 5, in urlgetter
sock = urllib.urlopen(url)
File "C:\Python26\lib\urllib.py", line 86, in urlopen
return opener.open(url)
File "C:\Python26\lib\urllib.py", line 207, in open
return getattr(self, name)(url)
File "C:\Python26\lib\urllib.py", line 346, in open_http
h.endheaders()
File "C:\Python26\lib\httplib.py", line 908, in endheaders
self._send_output()
File "C:\Python26\lib\httplib.py", line 780, in _send_output
self.send(msg)
File "C:\Python26\lib\httplib.py", line 739, in send
self.connect()
File "C:\Python26\lib\httplib.py", line 720, in connect
self.timeout)
File "C:\Python26\lib\socket.py", line 561, in create_connection
raise error, msg
IOError: [Errno socket error] [Errno 10061] No connection could be made because the target machine actively refused it
Damn.
Bask in the semi-done glory.
I'll add a bit of formatting and edit it above,[Done] but :l DAMN IT. IT'S NEVER EASY.
I'll put a sleep() statement in there and hopefully it will behave. Didn't work.
Let's hope I'm not blocked by AoOO for this!
John Egbert/John Egbert: 4
John Egbert/Jane Crocker: 12
John Egbert/Dave Strider: 3202
John Egbert/Dirk Strider: 159
John Egbert/Rose Lalonde: 465
John Egbert/Roxy Lalonde: 84
John Egbert/Jade Harley: 102
John Egbert/Jake English: 82
John Egbert/Aradia Megido: 7
John Egbert/Damara Megido: 2
John Egbert/Tavros Nitram: 20
John Egbert/Rufioh Nitram: 0
John Egbert/Sollux Captor: 50
John Egbert/Mituna Captor: 2
John Egbert/Karkat Vantas: 1477
John Egbert/Kankri Vantas: 2
John Egbert/Nepeta Leijon: 22
John Egbert/Meulin Leijon: 0
John Egbert/Kanaya Maryam: 2
John Egbert/Porrim Maryam: 2
John Egbert/Terezi Pyrope: 11
John Egbert/Latula Pyrope: 0
John Egbert/Vriska Serket: 571
John Egbert/Aranea Serket: 3
John Egbert/Equius Zahhak: 18
John Egbert/Horuus Zahhak: 0
John Egbert/Gamzee Makara: 44
John Egbert/Kurloz Makara: 0
John Egbert/Eridan Ampora: 38
John Egbert/Cronus Ampora: 0
John Egbert/Feferi Peixes: 13
John Egbert/Meenah Peixes: 5
-----------------------
Jane Crocker/Jane Crocker: 0
Jane Crocker/Dave Strider: 45
Jane Crocker/Dirk Strider: 171
Jane Crocker/Rose Lalonde: 11
Jane Crocker/Roxy Lalonde: 376
Jane Crocker/Jade Harley: 9
Jane Crocker/Jake English: 186
Jane Crocker/Aradia Megido: 4
Jane Crocker/Damara Megido: 2
Jane Crocker/Tavros Nitram: 0
Jane Crocker/Rufioh Nitram: 0
Jane Crocker/Sollux Captor: 0
Jane Crocker/Mituna Captor: 0
Jane Crocker/Karkat Vantas: 4
Jane Crocker/Kankri Vantas: 0
Jane Crocker/Nepeta Leijon: 2
Jane Crocker/Meulin Leijon: 0
Jane Crocker/Kanaya Maryam: 0
Jane Crocker/Porrim Maryam: 2
Jane Crocker/Terezi Pyrope: 10
Jane Crocker/Latula Pyrope: 0
Jane Crocker/Vriska Serket: 0
Jane Crocker/Aranea Serket: 0
Jane Crocker/Equius Zahhak: 0
Jane Crocker/Horuus Zahhak: 0
Jane Crocker/Gamzee Makara: 25
Jane Crocker/Kurloz Makara: 2
Jane Crocker/Eridan Ampora: 5
Jane Crocker/Cronus Ampora: 9
Jane Crocker/Feferi Peixes: 5
Jane Crocker/Meenah Peixes: 13
-----------------------
Dave Strider/Dave Strider: 22
Dave Strider/Dirk Strider: 438
Dave Strider/Rose Lalonde: 453
Dave Strider/Roxy Lalonde: 16
Dave Strider/Jade Harley: 976
Dave Strider/Jake English: 72
Dave Strider/Aradia Megido: 73
Dave Strider/Damara Megido: 5
Dave Strider/Tavros Nitram: 204
Dave Strider/Rufioh Nitram: 0
Dave Strider/Sollux Captor: 227
Dave Strider/Mituna Captor: 3
Dave Strider/Karkat Vantas: 1549
Dave Strider/Kankri Vantas: 6
Dave Strider/Nepeta Leijon: 38
Dave Strider/Meulin Leijon: 0
Dave Strider/Kanaya Maryam: 27
Dave Strider/Porrim Maryam: 3
Dave Strider/Terezi Pyrope: 776
Dave Strider/Latula Pyrope: 0
Dave Strider/Vriska Serket: 39
Dave Strider/Aranea Serket: 0
Dave Strider/Equius Zahhak: 16
Dave Strider/Horuus Zahhak: 0
Dave Strider/Gamzee Makara: 149
Dave Strider/Kurloz Makara: 0
Dave Strider/Eridan Ampora: 112
Dave Strider/Cronus Ampora: 7
Dave Strider/Feferi Peixes: 11
Dave Strider/Meenah Peixes: 0
-----------------------
Edit From A Lot Later: Yeaaah. This isn't going to work. Sorry.
Code is here:
import re
import urllib
import time
def urlgetter(url):
sock = urllib.urlopen(url)
htmlSource = sock.read()
sock.close()
return htmlSource
def getficnum(url):
html=urlgetter(url)
out=re.findall(r'[0-9]+ Works', html)
try:out=out[0][:-6]
except:out='0'
return out
def constructurl(name1,name2): #Names can use spaces between first+last name
name1.replace(" ", "%20")
name2.replace(" ", "%20")
return "http://archiveofourown.org/tags/"+name1+"*s*"+name2+"/works"
def getshipnum(name1,name2):
return getficnum(constructurl(name1,name2))
def getallshipnum(namelist):
for i in range(len(namelist)):
for j in range(i,len(namelist)):
print namelist[i]+"/"+namelist[j]+":\t"+getshipnum(namelist[i],namelist[j])
print "-----------------------"
def txttolist(filename): #with txt
fileobj=open(filename)
outlist=[]
for i in fileobj:
if i[-1]=='\n':
next1=[i[:-1]]
else:
next1=[i[:]]
outlist+=next1
return outlist
def filetofics(filename):
return getallshipnum(txttolist(filename))
If you can make it work, I applaud you.