Skip to content
Browse files

scraping

  • Loading branch information...
1 parent 64e2ca5 commit 1632af928c05b6c22e42a3872085649e1a8033c9 @jiahuang committed Dec 14, 2011
Showing with 9 additions and 11 deletions.
  1. +3 −7 README.md
  2. +6 −4 kickball.py
View
10 README.md
@@ -1,4 +1,4 @@
-# Kickball is an unofficial Kickstarter python API
+# Kickball scrapes Kickstarter for project information
Kickball allows for the following scrapes:
@@ -14,12 +14,8 @@ Scrape by project:
By default kickball scrapes for "all" regarding a project. p is a dictionary with the following:
p['url']
- p['author']['name']
- p['author']['url']
- p['pledged']
- p['num_backers']
- p['backers']
- p['backers'][#]['url']
+ p['successful']
+ p['author']['name'][#]['url']
p['backers'][#]['date']
p['backers'][#]['name']
p['num_comments']
View
10 kickball.py
@@ -1,5 +1,5 @@
'''
-kickball - an unoffical API for kickstarter
+kickball - kickstarter scraper
todo:
add in people browsing
@@ -132,7 +132,7 @@ def category(self, categoryType, projectType, scrapeType="all", maxPages=100):
raise Exception('Project type is not one of '+str(self.projectTypes))
if scrapeType.lower() not in self.scrapeTypes:
raise Exception('Scrape type is not one of '+str(self.scrapeTypes))
-
+
# put together url
url = self.urlBase+'/discover/categories/'+categoryType+'/'+projectType+'?page='
for i in range(1, maxPages):
@@ -148,6 +148,8 @@ def category(self, categoryType, projectType, scrapeType="all", maxPages=100):
projectDict = {}
if scrapeType.lower() in ['default', 'all']:
# grab as much as we can from the default pages
+ projectDict['category'] = categoryType
+ projectDict['projectType'] = projectType
projectDict['name'] = project.findAll('a')[1].contents[0]
projectDict['author'] = project.find('span').contents[0].rpartition('by')[2].strip()
projectDict['successful'] = True if project.find('div', {'class':'project-pledged-successful'}) else False
@@ -169,6 +171,6 @@ def category(self, categoryType, projectType, scrapeType="all", maxPages=100):
return projectsRes
-k = KickBall()
+#k = KickBall()
#k.category('art', 'recommended', 'all')
-k.project('/projects/1264285084/swoon-iv-the-techno-logy-issue')
+#k.project('/projects/1264285084/swoon-iv-the-techno-logy-issue')

0 comments on commit 1632af9

Please sign in to comment.
Something went wrong with that request. Please try again.