aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Lyon <matthewlyon18@gmail.com>2019-12-06 21:46:57 +1100
committerMatt Lyon <matthewlyon18@gmail.com>2019-12-06 21:46:57 +1100
commitc522656e488d8d573ff63a973172d7e3429f9476 (patch)
treea09ba52fd84b0972c2771a0e1d58b21d643b6168
parentdab7738fa8dfcb841494c00f8092257fb7542853 (diff)
downloadtpb-lite-c522656e488d8d573ff63a973172d7e3429f9476.tar.gz
tpb-lite-c522656e488d8d573ff63a973172d7e3429f9476.tar.bz2
tpb-lite-c522656e488d8d573ff63a973172d7e3429f9476.zip
fixed row removal issue
-rw-r--r--setup.py2
-rw-r--r--tpblite/models/torrents.py7
2 files changed, 6 insertions, 3 deletions
diff --git a/setup.py b/setup.py
index 4df49d6..300c7a0 100644
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@
from setuptools import setup, find_packages
setup(name='tpblite',
- version='0.1.0',
+ version='0.1.1',
description='The Unofficial Pirate Bay Lightweight Python API',
author='Matt Lyon',
author_email='matthewlyon18@gmail.com',
diff --git a/tpblite/models/torrents.py b/tpblite/models/torrents.py
index 79c05f1..32b6b5f 100644
--- a/tpblite/models/torrents.py
+++ b/tpblite/models/torrents.py
@@ -4,6 +4,7 @@ from bs4 import BeautifulSoup
from .utils import Query
+#TODO: implement a pretty print for Torrents object
def fileSizeStrToInt(size_str):
'''Converts file size given in *iB format to bytes integer'''
@@ -101,10 +102,12 @@ class Torrents(object):
def __getRows(self, soup):
rows = soup.body.find_all('tr')
- # remove first and last entries
+ # remove first entry (header)
if len(rows) > 1:
del rows[0]
- del rows[-1]
+ if len(rows) == 31:
+ # last row is bottom of page
+ del rows[-1]
return rows
else:
print('No torrents found!')