A robust web scraping pipeline with smart static/dynamic fallback and semantic text classification.
Project description
DeScraper 🕷️
DeScraper, hem statik hem de dinamik (JavaScript) web sitelerinden veri çekmek için tasarlanmış, hataya dayanıklı ve akıllı bir Python kütüphanesidir.
Otomatik olarak site yapısını analiz eder, en uygun yöntemi (Requests veya Selenium) seçer ve metinleri semantik olarak (Başlık, Menü, Haber İçeriği vb.) sınıflandırır.
Özellikler
- 🚀 Akıllı Mod: Önce hızlı yöntemle (Requests) dener, gerekirse otomatik olarak ağır silahlara (Selenium) geçer.
- 📜 Infinite Scroll Desteği: Sayfayı otomatik aşağı kaydırarak sonradan yüklenen içerikleri yakalar.
- 🧠 Semantik Analiz: Metinleri sadece "yazı" olarak değil;
heading,navigation,article_paragraphgibi türlerine göre ayırır. - 🛡️ Hata Toleransı: Ağ hatalarında otomatik tekrar deneme (retry) mekanizması vardır.
- 📦 Çift Kullanım: Hem Python kütüphanesi olarak hem de Komut Satırı (CLI) aracı olarak kullanılabilir.
Kurulum
pip install descraper
Kullanım
1. Terminalden (CLI) Kullanım
Kurulumdan sonra terminalinizde web-scraper komutu aktif olacaktır.
Basit Kullanım:
web-scraper https://www.ornek-haber-sitesi.com
JSON Dosyasına Kaydetme:
web-scraper https://www.ornek.com -o sonuc.json
Dinamik Mod ve Scroll (10 saniye bekleme):
web-scraper https://www.ornek.com -s dynamic -w 10
2. Python İçinde Kullanım
from descraper import run_scrape
url = "https://www.ornek.com"
# Veriyi çek
data = run_scrape(url, strategy='smart')
if data:
print(f"Başlık: {data['title']}")
# Sadece haber metinlerini al
print("\n--- Haber İçeriği ---")
for block in data['structured_text']:
if block['type'] == 'article_paragraph':
print(block['text'])
Gereksinimler
- Python 3.8+
- Firefox Tarayıcısı (Dinamik mod için gereklidir, sürücü otomatik indirilir)
Lisans
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file descraper-0.1.4.tar.gz.
File metadata
- Download URL: descraper-0.1.4.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5021b7979e6e2862393effd5f84c181654074ef96451d5adaebbfa08d76374cc
|
|
| MD5 |
b0a10b3abc133dc22735b2c5a18fafb4
|
|
| BLAKE2b-256 |
c889f85486c591d33a20ff3e894145baea419ecd1a56c7944f92f305fc863766
|
File details
Details for the file descraper-0.1.4-py3-none-any.whl.
File metadata
- Download URL: descraper-0.1.4-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef1f4e4324901eb79b39564806e6c76e239d39d38fcec8295e4b728b0f77349c
|
|
| MD5 |
d73f6e7ead493bdee70319909ffd5a4e
|
|
| BLAKE2b-256 |
18f38228e87e9557cf1fcb8b727debce0e0ba31084d0b3a3da3d1b890a840bd0
|