mirror of
https://github.com/NanmiCoder/MediaCrawler.git
synced 2026-02-06 23:21:33 +08:00
refactor: 优化抖音Crawler部分代码
fix: 日志初始化错误修复
This commit is contained in:
15
main.py
15
main.py
@@ -21,7 +21,6 @@ class CrawlerFactory:
|
||||
|
||||
|
||||
async def main():
|
||||
utils.init_loging_config()
|
||||
# define command line params ...
|
||||
parser = argparse.ArgumentParser(description='Media crawler program.')
|
||||
parser.add_argument('--platform', type=str, help='Media platform select (xhs|dy)...', default=config.PLATFORM)
|
||||
@@ -38,20 +37,6 @@ async def main():
|
||||
)
|
||||
await crawler.start()
|
||||
|
||||
"""
|
||||
# retry when exception ...
|
||||
while True:
|
||||
try:
|
||||
await crawler.start()
|
||||
except Exception as e:
|
||||
logging.info(f"crawler start error: {e} ...")
|
||||
await crawler.close()
|
||||
# If you encounter an exception
|
||||
# sleep for a period of time before retrying
|
||||
# to avoid frequent requests that may result in the account being blocked.
|
||||
await asyncio.sleep(config.RETRY_INTERVAL)
|
||||
"""
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user