Skip to content

Commit bcbeed0

Browse files
committed
feat add check empty articles list and exit program
1 parent bb2e98c commit bcbeed0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

opt/main.py

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from selenium import webdriver
33
from selenium.webdriver.chrome.options import Options
44
import os
5+
import sys
56

67
from zenn_scraper import ZennScraper
78
from notion_manager import NotionManager
@@ -24,6 +25,11 @@
2425
zenn_scraper = ZennScraper(publication_url)
2526
zenn_scraper.get_articles(driver)
2627

28+
if zenn_scraper.is_articles_empty():
29+
print("No articles found, stopping the program.")
30+
driver.quit()
31+
sys.exit()
32+
2733
notion_manager = NotionManager(notion_api_key, notion_database_id)
2834
notion_manager.delete_all_pages()
2935

0 commit comments

Comments
 (0)