Author
Aditya Sundar - Waseda University
Abstract
ဤ project သည် sitemap availability မခြား websites များကို systematically explore ပြီး comprehensive URL lists generate လုပ်ရန် design ထုတ်ထားသော web crawler develop လုပ်ပါသည်။ Crawler သည် static နှင့် dynamic content နှစ်ခုလုံး handle လုပ်ပြီး external references track လုပ်ကာ limited hardware တွင် efficiently operate လုပ်ပါသည်။
အဓိက Capabilities များ:
- Configurable concurrency ပါဝင်သော asynchronous crawling
- Systematic coverage အတွက် BFS-based URL discovery
- External reference tracking နှင့် analysis
- Playwright မှတစ်ဆင့် dynamic content support
- SQLite-based persistent storage
1. Introduction
Web crawling သည် websites များကို browse ပြီး data gather ရန် automated systems enable လုပ်ပေးပါသည်။ Sitemaps များသည် structured URL lists ပေးသော်လည်း websites အားလုံးတွင် မရှိပါ။ ဤ crawler သည်:
- Sitemaps ရှိသည်/မရှိသည် sites များတွင် work လုပ်သည်
- External sitemaps (other domains ကို reference လုပ်သော URLs) generate လုပ်သည်
- Proxies မပါဘဲ low-spec hardware တွင် run နိုင်သည်
- Large-scale websites များကို efficiently handle လုပ်သည်
2. Methodology
Technology Stack
| Technology | Purpose |
|---|
| Python | Primary language |
| aiohttp | Asynchronous HTTP requests |
| BeautifulSoup | HTML parsing နှင့် link extraction |
| asyncio | Concurrent code execution |
| SQLite | Persistent URL storage |
| Playwright | Dynamic content rendering |
| fake_useragent | Bot detection avoidance |
Crawler Workflow
- Initialization: Start URL normalize, robots.txt check, database tables create
- URL Fetching: Delays ပါဝင်သော asynchronous batch requests
- Link Extraction: Anchor tags parse, URLs normalize
- Data Storage: URLs, errors, external domains အတွက် SQLite
- Concurrency: Configurable limit (default: 100 concurrent)
- Completion: New URLs မရှိသောအခါ သို့မဟုတ် limit reach သောအခါ stop
BFS Algorithm
Crawler သည် URLs explore လုပ်ရန် Breadth-First Search အသုံးပြုသည်:
- Deeper move မဖြစ်မီ current depth ရှိ URLs အားလုံး process လုပ်သည်
- Level by level systematic coverage ensure လုပ်သည်
- Interrupted ဖြစ်ပါက resumption allow လုပ်သည်
Error Handling
| Error Type | Action |
|---|
| 404, 403, 400 | Skip (no retry) |
| 429 | Retry-After header စောင့်သည် |
| 500, 502, 503 | Delay ဖြင့် retry |
| Timeout | 3 times အထိ retry |
3. Results
Crawling Statistics
| Website Type | Internal URLs | External References |
|---|
| Entertainment Site 1 | 47,870 | 7,010,999 |
| Gaming Site 2 | 143,058 | 3,027,460 |
| Press Release Site | 99,243 | 2,136,887 |
| News Site 6 | 117,164 | 1,895,515 |
| Government Site 1 | 28,841 | 55,700 |
| Education Site 1 | 50,458 | 28,328 |
Totals:
- Internal URLs: 1,121,407
- External References: 18,957,040
Website Type အလိုက် External to Internal URL Ratio
Entertainment/news sites များသည် government sites များထက် external reference ratios ပိုများပြီး different content strategies reflect လုပ်ပါသည်။
SEO Insights
- Media sites: High external reference ratio သည် credibility တိုးစေနိုင်သည်
- Government sites: Internal linking အပေါ် focus သည် သင့်လျော်သည်
- Sites အများစုအတွက် balanced approach recommend ပြုလုပ်ပါသည်
4. Optimizations
Rate Limiting
connector = aiohttp.TCPConnector(limit=100) # Adjustable
Lower limits သည် 429 errors prevent လုပ်သော်လည်း crawling slow စေသည်။
Dynamic Content (SPAs)
Playwright သည် JavaScript-rendered content handle လုပ်သည်:
async def scrape_all_links(start_url):
async with async_playwright() as p:
browser = await p.chromium.launch(headless=False)
page = await browser.new_page()
URL Normalization
- Fragments remove လုပ်သည်
- Schemes unify လုပ်သည် (HTTPS only)
- Trailing slashes remove လုပ်သည်
- Database သည် duplicate crawling prevent လုပ်သည်
5. Future Directions
- Proxy support: IP blocking risk reduce လုပ်ခြင်း
- Better hardware: Larger crawls handle လုပ်ခြင်း
- Scrapy integration: Robust framework features leverage လုပ်ခြင်း
- Graph analysis: Embeddings အသုံးပြု၍ website relationships map ခြင်း
References
- aiohttp - Python အတွက် Asynchronous HTTP client/server
- BeautifulSoup - HTML/XML parsing library
- Playwright - Browser automation framework
- SQLite - Lightweight database engine