An open API service indexing awesome lists of open source software.

https://github.com/naravid19/isranews-scraper

A robust and parallel web scraper for isranews.org with multi-category support and data export.
https://github.com/naravid19/isranews-scraper

automation beautifulsoup data-collection isranews news news-scraper playwright python scraping thai-news web-scraper

Last synced: 3 months ago
JSON representation

A robust and parallel web scraper for isranews.org with multi-category support and data export.

Awesome Lists containing this project

README

          







isranews-scraper



A robust and parallel web scraper for isranews.org

with multi-category support and data export


---

## 📰 About the Project

`isranews-scraper` คือ Web Scraper อัตโนมัติสำหรับเว็บไซต์ [isranews.org](https://www.isranews.org)
รองรับการดึงข่าวพร้อมกันหลายหมวดหมู่ หลายหน้า สามารถ export ข้อมูลข่าวเป็นไฟล์ `CSV`, `Excel`, `JSON`, หรือ `TXT`
ใช้เทคนิค scraping แบบขนาน (parallel) ทำให้เร็วมาก รองรับการใช้งานผ่าน CLI แบบมืออาชีพ

Table of Contents


  1. Features

  2. Built With

  3. Getting Started

  4. Usage

  5. Roadmap

  6. License

---

## ✨ Features

* ✅ เลือกหมวดข่าวเอง หรือ scrape ทั้งเว็บ (multi-category)
* ✅ ดึงหลายหน้า, หลายหมวด, หรือกำหนด URL ได้
* ✅ รองรับ export หลายฟอร์แมต (`csv`, `excel`, `json`, `txt`)
* ✅ Scrape ข้อมูลข่าวแบบ parallel ด้วย multi-thread (เร็วมาก)
* ✅ อัปเดต/ผสานข้อมูลเดิมโดยอัตโนมัติ
* ✅ กรองข่าวตามวันที่ (`YYYY-MM-DD` หรือ พ.ศ.)
* ✅ ใช้งานผ่าน CLI พร้อม `--help`
* ✅ เหมาะกับ automation, data analysis, data pipeline

---

## 🛠️ Built With

* [Python 3.8+](https://www.python.org/)
* [Playwright](https://playwright.dev/)
* [BeautifulSoup4](https://www.crummy.com/software/BeautifulSoup/)
* [pandas](https://pandas.pydata.org/)
* [tqdm](https://tqdm.github.io/)

---

## 🚀 Getting Started

### Prerequisites

* Python >= 3.8
* ติดตั้งแพ็กเกจด้านล่าง

### Installation

```bash
pip install -r requirements.txt
python -m playwright install
```

---

## 💻 Usage

### Basic CLI Example

```bash
python isranews_scraper.py -c all -s 1 -e 3 -f excel -o ข่าวอิศรา
```

**ตัวเลือกหลัก:**

* `-c`, `--categories` เลือกหมวดข่าว (`all`, ชื่อหมวด, หมายเลข, หรือ path)
* `-s`, `--start` หน้าเริ่มต้น (default: 1)
* `-e`, `--end` หน้าสุดท้าย (`0` = ดึงจนจบ, default: 1)
* `-f`, `--format` รูปแบบไฟล์ export (`csv`, `excel`, `json`, `txt`)
* `-o`, `--output` ชื่อไฟล์ผลลัพธ์ (ไม่ต้องใส่นามสกุล)
* `-d`, `--date` กรองข่าวที่ใหม่กว่ากำหนด (`YYYY-MM-DD` หรือ พ.ศ.)
* `--max-threads` จำนวน threads (default: 8)
* `-h`, `--help` แสดงวิธีใช้งาน

### ตัวอย่างคำสั่ง

* ดึงข่าวทุกหมวด 3 หน้า เป็นไฟล์ Excel:

```bash
python isranews_scraper.py -c all -s 1 -e 3 -f excel -o ข่าวอิศรา
```

* ดึงเฉพาะ "ศูนย์ข่าวสืบสวน" ทุกหน้า เป็น JSON:

```bash
python isranews_scraper.py -c "ศูนย์ข่าวสืบสวน" -s 1 -e 0 -f json -o investigative-news
```

* ดึงข่าวหน้า 1-5, กรองวันที่หลัง 2024-01-01:

```bash
python isranews_scraper.py -c 1 -s 1 -e 5 -f csv -o isranews-news -d 2024-01-01
```

---

## 🔖 Roadmap

* [x] Parallel scraping (multi-thread)
* [x] Export หลาย format
* [x] Merge ข่าวกับไฟล์เก่า
* [ ] เพิ่ม feature ดึงภาพ/เอกสารประกอบข่าว
* [ ] ตั้งเวลาทำงานอัตโนมัติ (cron, schedule)
* [ ] Web UI / API

---

## 📄 License

Distributed under the MIT License.
See `LICENSE` for more information.

---

## 🙏 Acknowledgments

* [isranews.org](https://www.isranews.org)
* [Playwright](https://playwright.dev/)
* [BeautifulSoup4](https://www.crummy.com/software/BeautifulSoup/)
* [Best-README-Template](https://github.com/othneildrew/Best-README-Template)

(back to top)

---

**หมายเหตุ:**

* โค้ดและ README นี้เน้นเพื่อการศึกษา/รีเสิร์ช
* ข้อความและตัวอย่างหมวดหมู่ใน isranews อาจเปลี่ยนแปลงได้