Hi,
I've just started learning Python and for my first script I wanted to make something that would make life easier and that I would actually use, so starting small I've began working on a Torrent Search script that uses the ISOHunt API. However I've ran into a problem in the unfinished method that cleans the results from the search:
def sanitise(string):
a = string.split('{"title":') # split page into parts, a is list
for i in range(len(a)):
a[i].lower() # lower every char on page
index = a[i].find('"enclosure_url":')
b = a[i].replace(a[:index], "")
print a[i]
Here's an example search result:
<b>Inception</b>.FRENCH.DVDRip.XViD-DVDFR",
"link":"http:\/\/isohunt.com\/torrent_details\/255340617\/inception?tab=summary",
"guid":"255340617","enclosure_url":
"http://ca.isohunt.com........."
My script only needs 3 pieces of information, so basically what I'm trying to do is cut out the bit of string that is in front of "enclosure_url" but from my code above, I keep getting the error:
"TypeError: expected a character buffer object".
Could anyone help me fix this?