Skip to content

Commit 50619c2

Browse files
committed
Updated the Pastebin module - should work now!
1 parent 2a2fa7d commit 50619c2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/Pastebin.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,17 @@ def __init__(self, last_id=None):
2828
def update(self):
2929
'''update(self) - Fill Queue with new Pastebin IDs'''
3030
logging.info('Retrieving Pastebin ID\'s')
31-
results = BeautifulSoup(helper.download(self.BASE_URL + '/archive')).find_all(
32-
lambda tag: tag.name == 'td' and tag.a and '/archive/' not in tag.a['href'] and tag.a['href'][1:])
3331
new_pastes = []
32+
raw = None
33+
while not raw:
34+
try:
35+
raw = self.session.get(self.BASE_URL + '/archive').text
36+
except:
37+
logging.info('Error with pastebin')
38+
raw = None
39+
sleep(5)
40+
results = BeautifulSoup(raw).find_all(
41+
lambda tag: tag.name == 'td' and tag.a and '/archive/' not in tag.a['href'] and tag.a['href'][1:])
3442
if not self.ref_id:
3543
results = results[:60]
3644
for entry in results:

0 commit comments

Comments
 (0)