fix: remove hardcoded integer
This commit is contained in:
@@ -18,6 +18,9 @@ from .typings import BoardPath, SearchType
|
|||||||
from models import Attachment, Post
|
from models import Attachment, Post
|
||||||
|
|
||||||
|
|
||||||
|
LIST_MAX_POSTS = 200
|
||||||
|
|
||||||
|
|
||||||
class Scraper(ClientSession):
|
class Scraper(ClientSession):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@@ -29,7 +32,7 @@ class Scraper(ClientSession):
|
|||||||
|
|
||||||
# 게시글 목록 조회로 한 번에 불러올 항목 수
|
# 게시글 목록 조회로 한 번에 불러올 항목 수
|
||||||
self.cookie_jar.update_cookies({
|
self.cookie_jar.update_cookies({
|
||||||
'list_count': '200'
|
'list_count': LIST_MAX_POSTS
|
||||||
})
|
})
|
||||||
|
|
||||||
async def __aenter__(self) -> 'Scraper':
|
async def __aenter__(self) -> 'Scraper':
|
||||||
@@ -84,7 +87,7 @@ class Scraper(ClientSession):
|
|||||||
for tag in document.select('.gall-detail-lnktb')
|
for tag in document.select('.gall-detail-lnktb')
|
||||||
]
|
]
|
||||||
|
|
||||||
async def view(self, post: Post):
|
async def view(self, post: Post) -> Post:
|
||||||
"""
|
"""
|
||||||
게시글 내용을 조회합니다
|
게시글 내용을 조회합니다
|
||||||
|
|
||||||
@@ -138,7 +141,7 @@ class Scraper(ClientSession):
|
|||||||
for tag in post.body.select('script, style'):
|
for tag in post.body.select('script, style'):
|
||||||
tag.extract()
|
tag.extract()
|
||||||
|
|
||||||
print(f'{post.board_id}/{post.id}: {post.title}')
|
return post
|
||||||
|
|
||||||
async def fetch_voice(self, id: str):
|
async def fetch_voice(self, id: str):
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user