Metadata-Version: 2.4
Name: bloksar
Version: 0.1.3
Summary: JSON tarif ile web scraper framework — kod yazmadan web sitesi kazı
Author: lokkiDEV
License: MIT
Project-URL: Homepage, https://github.com/lokkiDEV/BLOKSAR
Project-URL: Repository, https://github.com/lokkiDEV/BLOKSAR
Keywords: scraper,web-scraping,crawler,framework,no-code,json-recipe
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: beautifulsoup4>=4.9
Provides-Extra: css
Requires-Dist: beautifulsoup4>=4.9; extra == "css"
Provides-Extra: xlsx
Requires-Dist: openpyxl>=3.0; extra == "xlsx"
Provides-Extra: xpath
Requires-Dist: lxml>=4.6; extra == "xpath"
Provides-Extra: all
Requires-Dist: beautifulsoup4>=4.9; extra == "all"
Requires-Dist: openpyxl>=3.0; extra == "all"
Requires-Dist: lxml>=4.6; extra == "all"
Dynamic: license-file

# BLOKSAR — Web Scraper Factory

[![tests](https://github.com/lokkiDEV/BLOKSAR/actions/workflows/test.yml/badge.svg)](https://github.com/lokkiDEV/BLOKSAR/actions/workflows/test.yml)

JSON tarif ile web sitesi kazı. Kod yazmana gerek yok.

## Kurulum

```bash
git clone https://github.com/lokkiDEV/BLOKSAR.git
cd BLOKSAR
python --version  # Python 3.8+ gerekli
```

Ek bağımlılık yok. Standart Python kütüphanesi yeterli.

> **Not:** Bu paket şu an `scraper` adlı bir modülü de kurar. Ortamınızda aynı
> adda başka bir paket varsa çakışma yaşayabilirsiniz; bu durumda lütfen bildirin.
> `0.2.0` sürümünde her şey tek `bloksar` paketi altına taşınacaktır.

## Hızlı Başlangıç

```bash
# Kur (tek seferlik) — bloksar komutunu sisteme ekler
pip install -e .

# Hazır tarif ile çalıştır
bloksar run books_real.json
```

Alternatif (kurulumsuz, modül olarak):

```bash
# Hazır tarif ile çalıştır
cd tools
python -m scraper.engine books_real.json

# Sihirbaz ile yeni tarif oluştur (kod bilmeden)
python -m scraper.wizard https://example.com

# Standalone script üret (müşteriye teslim)
python -m scraper.factory books_real.json MusteriAdi
```

## Özellikler

| Özellik | Açıklama |
|---------|----------|
| JSON tarif | Site yapısını JSON ile tanımla, çalıştır |
| Diff tespiti | İki run arasındaki değişiklikleri bul |
| Quality trend | Alan doluluk düşüşünü otomatik uyar |
| Standalone script | Müşteriye bağımsız `.py` dosyası teslim et |
| Wizard | Kod bilmeden tarif oluştur |
| Dedup | Aynı URL'yi iki kez çekme |
| Multi-record | Tek sayfadan N kayıt üret |

## Tarif Formatı

```json
{
  "name": "urun_listesi",
  "description": "Ürün listesi tarifi",
  "start_urls": ["https://example.com/urunler"],
  "pagination": {
    "type": "url_template",
    "template": "https://example.com/urunler?page={page}",
    "start": 1,
    "end": 5
  },
  "detail_urls": {
    "type": "regex",
    "pattern": "<a href=\"(/urun/[^\"]+)\"",
    "base": "https://example.com"
  },
  "detail_selectors": {
    "baslik": {
      "type": "regex",
      "pattern": "<h1[^>]*>(.*?)</h1>",
      "single": true
    },
    "fiyat": {
      "type": "regex",
      "pattern": "<span class=\"price\">(.*?)</span>",
      "single": true
    }
  },
  "rate_limit": 1.0,
  "max_items": 100,
  "output": "urun_listesi.json"
}
```

## Çıktı

Her run sonrası 3 dosya üretilir:

```
output/scrapes/urun_listesi.json   ← veri
output/scrapes/urun_listesi.csv    ← Excel için
output/diffs/urun_listesi_diff.json ← değişiklik raporu (2. run'dan itibaren)
```

## Diff Örneği

```
========================================
  DIFF SONUCU
========================================
  added:     3
  removed:   1
  changed:   5
  unchanged: 91
========================================
  fiyat: '199 TL' → '249 TL'
```

> Gerçek örnek: Hürriyet gündem — 30 kayıt, %100 alan doluluk.

## Modüller

| Modül | Görev |
|-------|-------|
| cli.py | `bloksar run / wizard / package` komut arayüzü |
| engine.py | Tarif çalıştırıcı |
| diff.py | Değişiklik tespiti |
| net.py | HTTP (retry, rate limit) |
| parse.py | HTML ayrıştırma |
| store.py | JSON + CSV + SQLite |
| quality.py | Alan doluluk + trend uyarısı |
| dedup.py | Aynı URL/kaydı tekrar çekmeyi önle |
| wizard.py | Sihirbaz (no-code tarif) |
| factory.py | Standalone script üretici |
| validator.py | Üretilen scripti test et |
| packager.py | ZIP paketleme |
| analyzer.py | Site yapısı analizi |

## Test

```bash
python test_diff.py
python test_engine_diff.py
python test_quality_trend.py
# Toplam: 120+ PASS
```

## Hire Me

Kod yazdırma / özel web scraping hizmeti mi lazım? İş teklifleri için
GitHub üzerinden iletişime geçebilirsiniz: https://github.com/lokkiDEV/BLOKSAR

- JSON tarif ile hızlı scraper kurulumu
- Müşteriye teslim edilebilir standalone script
- Diff + quality takibi ile sürekli izleme

## Yasal Uyarı / Disclaimer

**Türkçe:** BLOKSAR yalnızca teknik erişim sağlayan bir araçtır. Hangi
verinin, hangi siteden çekileceği tamamen **kullanıcının sorumluluğundadır.**
Telif hakkı, veritabanı hakkı ve veri koruma mevzuatına (GDPR / KVKK) uyum
kullanıcıya aittir. Aracın içerdiği robots.txt kontrolü teknik ve etik bir
uyum katmanıdır; **yasal bir kalkan değildir.** Araç "olduğu gibi" (as-is),
hiçbir garanti verilmeden sunulur. Soru ve bildirimler için GitHub Issues.

**English:** BLOKSAR is a tool that provides technical access only. What data
is scraped, and from which site, is entirely the **user's responsibility.**
Compliance with copyright, database rights, and data-protection law
(GDPR / KVKK) rests with the user. The built-in robots.txt check is a
technical and ethical compliance layer; it is **not a legal shield.** The tool
is provided "as-is", without any warranty. For questions and reports, use
GitHub Issues.

## Lisans

MIT
