Code: Select all
def id_of_post(post):
try:
body = post.findParent('tr').parent.find('span', 'postdetails')
return body.contents[2].split(': ')[1].strip()
except AttributeError:
return '??'
Seems to work for me.
Code: Select all
def id_of_post(post):
try:
body = post.findParent('tr').parent.find('span', 'postdetails')
return body.contents[2].split(': ')[1].strip()
except AttributeError:
return '??'
Player Summary for Kison
------------------------
3.4% of total activity (39/1154)
Total words posted: 4646. Average per post: 119.13
--------------------------------------------------
Someone earlier in the thread had a graph using word counts. Not sure if I can do that, but I can try sometime later.Player Summary for Jitsu
------------------------
8.1% of total activity (93/1154)
Total words posted: 20697. Average per post: 222.55
---------------------------------------------------
I've done some more research and found a way to perform different types of conversion(backslash escaping, XML, replace, and ignore). The last two are more along the lines of what I was doing to prevent the script from crashing. When I use the XML conversion method, and run the script on the page, KaleiÃMr. Flay wrote:Surely there's a way to 'escape' the non-ASCII characters? I don't know the language this is written in, but usually additional quotes do the trick.