mirror of
https://github.com/kemayo/leech
synced 2025-12-09 09:53:30 +01:00
Xenforo option: stop-after
This commit is contained in:
parent
a5fb14d61a
commit
8ce3c7f709
1 changed files with 4 additions and 3 deletions
|
|
@ -32,13 +32,13 @@ class XenForo(Site):
|
|||
story['title'] = soup.find('h1').get_text()
|
||||
story['author'] = soup.find('p', id='pageDescription').find('a', class_='username').get_text()
|
||||
|
||||
marks = self._chapter_list(url)
|
||||
marks = [mark for mark in self._chapter_list(url) if '/members' not in mark.get('href')]
|
||||
if self.options.stop_after:
|
||||
marks = marks[:self.options.stop_after]
|
||||
|
||||
chapters = []
|
||||
for idx, mark in enumerate(marks, 1):
|
||||
href = mark.get('href')
|
||||
if '/members' in href:
|
||||
continue
|
||||
if not href.startswith('http'):
|
||||
href = base + href
|
||||
print("Fetching chapter", mark.string, href)
|
||||
|
|
@ -140,6 +140,7 @@ class XenForo(Site):
|
|||
|
||||
def _add_arguments(self, parser):
|
||||
parser.add_argument('--include-index', dest='include_index', action='store_true', default=False)
|
||||
parser.add_argument('--stop-after', dest='stop_after', type=int, default=None)
|
||||
|
||||
|
||||
class XenForoIndex(XenForo):
|
||||
|
|
|
|||
Loading…
Reference in a new issue