How nguyenmanhcuong-huster/tool-scrape-blog works
Project type and purpose
• This is a command-line Python data-processing pipeline that crawls blog URLs, extracts and filters title keywords, checks for duplicates against an existing blog database, and outputs the final set of “main keys” to files (Excel, HTML).
• Key indicators:
• main.py orchestrates the run
• source/crawl_title holds crawling, parsing, filtering, exporting logic
• source/database handles database lookups
• source/download_model fetches any ML or dictionary model
High-level file-structure analysis
• Top-level:
– main.py: entry point
– requirements.txt, chromedriver folder: dependencies for Selenium
– database/*.xlsx: reference data
– input.txt / output.xlsx: I/O
• source/:
– download_model/: model/resource downloader
– database/: modules to read/check existing keys
– crawl_title/: the core pipeline steps
• selenium_driver.py (webdriver abstraction)
• crawl_title_from_link.py (URL fetcher)
• filter_title.py (title cleaning)
• extract_key_word.py (keyword candidate extractor)
• translater.py (if needed for i18n)
• excel_handler.py, export_html.py (final output)
README architecture insights
• Describes a five-step process:
1. Fetch all blog URLs
2. Extract titles
3. Derive “main key” from each title
4. Check duplicates against timviec365.vn database
5. Export remaining keys
Components & interactions
a. Main components:
• Controller: main.py
• Crawler Service: source/crawl_title/selenium_driver.py + crawl_title_from_link.py
• Parser/Extractor: filter_title.py + extract_key_word.py + translater.py
• Storage/DB Layer: source/database/get_title_database.py + database/*.xlsx
• Model Downloader: source/download_model/downloadModel.py
• Exporters: excel_handler.py + export_html.py
• External Systems:
– Target websites (topcv.vn, timviec365.vn)
– ChromeDriver/Chrome headless browser
b. Relationships & data flows:
1. main.py invokes Model Downloader (if needed) → ensures keyword extraction resources
2. main.py starts Crawler Service → retrieves list of post URLs → passes URLs to Parser/Extractor
3. Parser/Extractor cleans titles, extracts key phrases → looks up each key phrase via DB Layer
4. DB Layer queries existing blog database (database/*.xlsx) and timviec365 website
5. Filter out duplicates → hand off to Exporters
6. Exporters write results to output.xlsx and HTML
c. Architectural patterns & principles:
• Pipeline pattern: each module is a stage in the data pipeline
• Single Responsibility per module (crawler vs parser vs exporter)
• Loose coupling: use function calls/imports rather than monolithic scripts
• Clear separation of I/O (database/excel/files) vs business logic
d. Key technologies/frameworks:
• Python 3.x
• Selenium + ChromeDriver (source/crawl_title/selenium_driver.py)
• openpyxl / pandas (likely used in excel_handler.py)
• Custom keyword-extraction logic (extract_key_word.py)
• HTTP client (requests) or Selenium for DB checks
Capturing essential details
• Configuration/dependency (requirements.txt, chromedriver) as a supporting block