Skip to content

Instantly share code, notes, and snippets.

@draftcode
Created August 24, 2011 00:47
Show Gist options
  • Select an option

  • Save draftcode/1167032 to your computer and use it in GitHub Desktop.

Select an option

Save draftcode/1167032 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import urllib
import re
import logging
def extract_booklist(user_id, category="", kininaru="0"):
page = 1
while(True):
url = "http://book.akahoshitakuya.com/u/%s/booklist%s&p=%s" % \
(user_id, category, page)
s = urllib.urlopen(url).read()
count = 0
for match in re.finditer('<div class="book"><a href="/b/(.*?)">', s):
print "ASIN\t%s\t\t\t\t\t\t%s" % (match.group(1), kininaru)
count += 1
if count == 0:
break
else:
page += 1
extract_booklist(95348, "", "0")
extract_booklist(95348, "now", "0")
extract_booklist(95348, "tun", "0")
extract_booklist(95348, "pre", "1")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment