Skip to content

Commit

Permalink
Encoding wa
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBlusky committed May 30, 2015
1 parent 9610934 commit 28fdf54
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion slackcrawl.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def get_file_page(self, page=1):
for a in page_soup.find("div", {"class": "pagination"}).find_all('a'):
if a.get_text() is not None and a.get_text().isdigit() and int(a.get_text()) > self.page_count:
self.page_count = int(a.get_text())
self.paginated = True
print " -> got " + str(self.page_count) + " pages"
print "[+] Retrieving files on page #" + str(page)
json_line = ""
Expand All @@ -77,10 +78,10 @@ def __init__(self, slack_session):
self.slack_session = slack_session

def download(self, slack_file):
print "[+] Downloading " + (slack_file['name'] if 'name' in slack_file else "unnamed file")
if not os.path.exists(self.slack_session.dir + "/files"):
os.makedirs(self.slack_session.dir + "/files")
try:
print "[+] Downloading ..."
local_filename = self.slack_session.dir + "/files/" + str(slack_file['created']) + "_" + slack_file['name']
r = self.slack_session.session.get(slack_file['url_private_download'], stream=True)
with open(local_filename, 'wb') as f:
Expand Down

0 comments on commit 28fdf54

Please sign in to comment.