Skip to main content

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

TechnologyPurpose
PythonPrimary language
aiohttpAsynchronous HTTP requests
BeautifulSoupHTML parsing နှင့် link extraction
asyncioConcurrent code execution
SQLitePersistent URL storage
PlaywrightDynamic content rendering
fake_useragentBot detection avoidance

Crawler Workflow

  1. Initialization: Start URL normalize, robots.txt check, database tables create
  2. URL Fetching: Delays ပါဝင်သော asynchronous batch requests
  3. Link Extraction: Anchor tags parse, URLs normalize
  4. Data Storage: URLs, errors, external domains အတွက် SQLite
  5. Concurrency: Configurable limit (default: 100 concurrent)
  6. 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 TypeAction
404, 403, 400Skip (no retry)
429Retry-After header စောင့်သည်
500, 502, 503Delay ဖြင့် retry
Timeout3 times အထိ retry

3. Results

Crawling Statistics

Website TypeInternal URLsExternal References
Entertainment Site 147,8707,010,999
Gaming Site 2143,0583,027,460
Press Release Site99,2432,136,887
News Site 6117,1641,895,515
Government Site 128,84155,700
Education Site 150,45828,328
Totals:
  • Internal URLs: 1,121,407
  • External References: 18,957,040
URL Ratio Chart

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

  1. Proxy support: IP blocking risk reduce လုပ်ခြင်း
  2. Better hardware: Larger crawls handle လုပ်ခြင်း
  3. Scrapy integration: Robust framework features leverage လုပ်ခြင်း
  4. Graph analysis: Embeddings အသုံးပြု၍ website relationships map ခြင်း

References

  1. aiohttp - Python အတွက် Asynchronous HTTP client/server
  2. BeautifulSoup - HTML/XML parsing library
  3. Playwright - Browser automation framework
  4. SQLite - Lightweight database engine