From 28fdf5460a6da1f289c05947f4579886c08ba1da Mon Sep 17 00:00:00 2001 From: Blusky Date: Sat, 30 May 2015 19:46:29 +0200 Subject: [PATCH] Encoding wa --- slackcrawl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/slackcrawl.py b/slackcrawl.py index 0b5c546..2bd4887 100644 --- a/slackcrawl.py +++ b/slackcrawl.py @@ -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 = "" @@ -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: