pastebin - collaborative debugging tool
fferen.kpaste.net RSS


wheeee
Posted by Anonymous on Thu 6th Jan 2011 16:46
raw | new post
view followups (newest first): wheeee by Anonymous

  1. import urllib2 as url
  2.  
  3. def getBetween(s, e, searched):
  4.     sInd = searched.find(s)
  5.     return searched[sInd + len(s):searched.find(e, sInd)]
  6.  
  7. def get(url):
  8.     isHards = []
  9.     isbns = []
  10.     done = False
  11.     for pg in xrange(1, 5000):
  12.         html = url.urlopen(url + '?PG=%d' % pg).read()
  13.         eInd = 0
  14.         while True:
  15.             sInd = html.find("<span class='regGray11px'>(", eInd)
  16.             if sInd == -1:
  17.                 if eInd == 0:
  18.                     done = True
  19.                 break
  20.             eInd = html.find("</span>\n", sInd)
  21.             foo = html[sInd + len("<span class='regGray11px'>("):eInd]
  22.             isHards.append('Hardback' in foo)
  23.             isbns.append(getBetween('ISBN10: ', ';', foo))
  24.         if done:
  25.             break
  26.     return results
  27.  
  28. print get('http://www.textbooks.com/Catalog/KMG/Geometry-for-K-12.php')
  29.  
  30. ######
  31.  
  32. http://www.chartwellyorke.com/fathom/fathomdemos.html
  33.  
  34. http://isbndb.com/

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}





All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at