Skip to content

About

BISG: Book Industry Study Group, BISAC: Subject Codes The Industry Standard in Categorization Scrapper

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

BISAC Codes Scraper with Turkish Translation / Türkçe Çevirili BISAC Kodları Toplayıcısı

License: ISC Node.js Docker LibreTranslate

English

Overview

This project is a web scraper that automatically collects BISAC (Book Industry Study Group Subject Codes) from the official BISG website and exports them to a CSV file. BISAC codes are the industry standard for categorizing books and publications.

What are BISAC Codes?

BISAC (Book Industry Study Group Subject Codes) are standardized subject headings used by the book industry to categorize books and publications. Each code follows the format ABC123456 where:

  • First 3 characters: Main category (e.g., ANT for Antiques & Collectibles)
  • Last 6 digits: Specific subcategory

Features

  • 🔍 Automated Web Scraping: Fetches data from https://bisg.org/page/bisacedition
  • 📊 CSV Export: Exports all codes to a structured CSV file
  • 🌍 Turkish Translation: Automatically translates descriptions to Turkish using LibreTranslate
  • 🐳 Docker Integration: Local LibreTranslate server for reliable, unlimited translations
  • 🚀 Batch Processing: Optimized batch translation (50 items per batch)
  • 🛡️ Error Handling: Robust error handling for network issues
  • 🔄 Flexible Parsing: Adapts to different HTML structures
  • 📝 Detailed Logging: Comprehensive console output for monitoring

Installation

  1. Clone the repository:
git clone <repository-url>
cd bisaccodes
  1. Install dependencies:
npm install
  1. Optional but Recommended: Install Docker Desktop for local translation server:
    • Download from Docker Desktop
    • Install and start Docker Desktop
    • This enables unlimited, fast translations without API rate limits

Usage

Basic Scraping

Run the scraper:

node jscrapebisacs.js
# or
npm run scrape

With Turkish Translation (Recommended: Using Local LibreTranslate)

Step 1: Start LibreTranslate server (if using Docker):

# Windows
start-libretranslate.bat

# Or manually with Docker Compose
docker-compose up -d

Step 2: Run translation script:

node addtranslation.js
# or
npm run translate

Step 3: Stop LibreTranslate server when done:

# Windows
stop-libretranslate.bat

# Or manually
docker-compose down

Complete Process

Run both scraping and translation:

npm run full

The scripts will:

  1. Load the main BISG page
  2. Find all subcategory links
  3. Scrape BISAC codes from each page
  4. Save results to bisac.csv
  5. (Optional) Translate descriptions to Turkish using LibreTranslate and save to bisac_with_translations.csv

Output Format

The generated CSV file contains:

  • Code: BISAC code (e.g., ANT000000)
  • Description: Category description (e.g., Antiques & Collectibles / General)
  • DescriptionTR: Turkish translation (e.g., Antikalar ve Koleksiyon Ürünleri / Genel)
  • Comment: Additional notes (if any)

Dependencies

  • jsdom: HTML parsing and DOM manipulation
  • node-fetch: HTTP requests (built-in fetch in Node.js 18+)
  • Docker: For running LibreTranslate locally (optional but recommended)
  • LibreTranslate: Open-source translation server (runs in Docker container)

Project Structure

bisaccodes/
├── jscrapebisacs.js              # Main scraping script
├── addtranslation.js             # Turkish translation script
├── docker-compose.yml            # LibreTranslate Docker configuration
├── start-libretranslate.bat      # Start LibreTranslate server
├── stop-libretranslate.bat       # Stop LibreTranslate server
├── bisac.csv                    # Generated CSV output
├── bisac_with_translations.csv  # CSV with Turkish translations
├── package.json                 # Node.js configuration
├── package-lock.json            # Dependency lock file
└── README.md                   # This file

Example Output

Basic CSV (bisac.csv)

"Code","Description","Comment"
"","Complete BISAC Subject Headings List","Generated on 2025-10-10T13:56:11.302Z from https://bisg.org/page/bisacedition"
"ANT000000","Antiques & Collectibles / General",""
"ANT056000","Antiques & Collectibles / Advertising",""
"ANT002000","Antiques & Collectibles / Art",""

With Turkish Translation (bisac_with_translations.csv)

"Code","Description","DescriptionTR","Comment"
"","Complete BISAC Subject Headings List","Türkçe çeviriler eklendi","Generated on 2025-10-10T13:56:11.302Z from https://bisg.org/page/bisacedition"
"ANT000000","Antiques & Collectibles / General","Antikalar ve Koleksiyon Ürünleri / Genel",""
"ANT056000","Antiques & Collectibles / Advertising","Antikalar ve Koleksiyon Ürünleri / Reklamcılık",""
"ANT002000","Antiques & Collectibles / Art","Antikalar ve Koleksiyon Ürünleri / Sanat Eserleri",""

Translation Features

  • 🚀 Local LibreTranslate Server: No API rate limits or external dependencies
  • 📦 Docker Integration: Easy setup with docker-compose up -d
  • ⚡ Batch Processing: Processes 50 translations per batch for optimal performance
  • 🔄 Automatic Retry: Handles temporary network issues gracefully
  • 📊 Progress Tracking: Real-time progress updates during translation
  • 🛡️ Fallback Handling: Uses original text if translation fails

Error Handling

The script includes comprehensive error handling for:

  • Network connectivity issues
  • HTTP response errors
  • HTML parsing failures
  • Missing DOM elements
  • Translation API failures
  • Docker container issues

License

ISC License - see LICENSE file for details.


Türkçe

Genel Bakış

Bu proje, resmi BISG web sitesinden BISAC (Book Industry Study Group Subject Codes) kodlarını otomatik olarak toplayan ve bunları CSV dosyasına aktaran bir web scraper'dır. BISAC kodları, kitapları ve yayınları kategorize etmek için kullanılan endüstri standardıdır.

BISAC Kodları Nedir?

BISAC (Book Industry Study Group Subject Codes), kitap endüstrisi tarafından kitapları ve yayınları kategorize etmek için kullanılan standartlaştırılmış konu başlıklarıdır. Her kod ABC123456 formatını takip eder:

  • İlk 3 karakter: Ana kategori (örn. ANT Antiques & Collectibles için)
  • Son 6 rakam: Spesifik alt kategori

Özellikler

  • 🔍 Otomatik Web Scraping: https://bisg.org/page/bisacedition adresinden veri çeker
  • 📊 CSV Dışa Aktarma: Tüm kodları yapılandırılmış CSV dosyasına aktarır
  • 🌍 Türkçe Çeviri: LibreTranslate kullanarak açıklamaları otomatik olarak Türkçe'ye çevirir
  • 🐳 Docker Entegrasyonu: Güvenilir, sınırsız çeviriler için yerel LibreTranslate sunucusu
  • 🚀 Toplu İşleme: Optimize edilmiş toplu çeviri (grup başına 50 öğe)
  • 🛡️ Hata Yönetimi: Ağ sorunları için güçlü hata yönetimi
  • 🔄 Esnek Ayrıştırma: Farklı HTML yapılarına uyum sağlar
  • 📝 Detaylı Loglama: İzleme için kapsamlı konsol çıktısı

Kurulum

  1. Depoyu klonlayın:
git clone <repository-url>
cd bisaccodes
  1. Bağımlılıkları yükleyin:
npm install
  1. İsteğe Bağlı ama Önerilen: Yerel çeviri sunucusu için Docker Desktop kurun:
    • Docker Desktop adresinden indirin
    • Docker Desktop'ı kurun ve başlatın
    • Bu, API hız sınırları olmadan sınırsız, hızlı çeviriler sağlar

Kullanım

Temel Scraping

Scraper'ı çalıştırın:

node jscrapebisacs.js
# veya
npm run scrape

Türkçe Çeviri ile (Önerilen: Yerel LibreTranslate Kullanarak)

Adım 1: LibreTranslate sunucusunu başlatın (Docker kullanıyorsanız):

# Windows
start-libretranslate.bat

# Veya manuel olarak Docker Compose ile
docker-compose up -d

Adım 2: Çeviri scriptini çalıştırın:

node addtranslation.js
# veya
npm run translate

Adım 3: İşiniz bittiğinde LibreTranslate sunucusunu durdurun:

# Windows
stop-libretranslate.bat

# Veya manuel olarak
docker-compose down

Tam Süreç

Hem scraping hem çeviriyi çalıştırın:

npm run full

Script şunları yapacak:

  1. Ana BISG sayfasını yükleyecek
  2. Tüm alt kategori linklerini bulacak
  3. Her sayfadan BISAC kodlarını toplayacak
  4. Sonuçları bisac.csv dosyasına kaydedecek
  5. (İsteğe bağlı) Açıklamaları LibreTranslate kullanarak Türkçe'ye çevirip bisac_with_translations.csv dosyasına kaydedecek

Çıktı Formatı

Oluşturulan CSV dosyası şunları içerir:

  • Code: BISAC kodu (örn. ANT000000)
  • Description: Kategori açıklaması (örn. Antiques & Collectibles / General)
  • DescriptionTR: Türkçe çeviri (örn. Antikalar ve Koleksiyon Ürünleri / Genel)
  • Comment: Ek notlar (varsa)

Bağımlılıklar

  • jsdom: HTML ayrıştırma ve DOM manipülasyonu
  • node-fetch: HTTP istekleri (Node.js 18+ ile yerleşik fetch)
  • Docker: LibreTranslate'ı yerel olarak çalıştırmak için (isteğe bağlı ama önerilen)
  • LibreTranslate: Açık kaynak çeviri sunucusu (Docker konteynerinde çalışır)

Proje Yapısı

bisaccodes/
├── jscrapebisacs.js              # Ana scraping scripti
├── addtranslation.js             # Türkçe çeviri scripti
├── docker-compose.yml            # LibreTranslate Docker yapılandırması
├── start-libretranslate.bat      # LibreTranslate sunucusunu başlat
├── stop-libretranslate.bat       # LibreTranslate sunucusunu durdur
├── bisac.csv                    # Oluşturulan CSV çıktısı
├── bisac_with_translations.csv  # Türkçe çevirilerle CSV
├── package.json                 # Node.js yapılandırması
├── package-lock.json            # Bağımlılık kilidi dosyası
└── README.md                   # Bu dosya

Örnek Çıktı

Temel CSV (bisac.csv)

"Code","Description","Comment"
"","Complete BISAC Subject Headings List","Generated on 2025-10-10T13:56:11.302Z from https://bisg.org/page/bisacedition"
"ANT000000","Antiques & Collectibles / General",""
"ANT056000","Antiques & Collectibles / Advertising",""
"ANT002000","Antiques & Collectibles / Art",""

Türkçe Çeviri ile (bisac_with_translations.csv)

"Code","Description","DescriptionTR","Comment"
"","Complete BISAC Subject Headings List","Türkçe çeviriler eklendi","Generated on 2025-10-10T13:56:11.302Z from https://bisg.org/page/bisacedition"
"ANT000000","Antiques & Collectibles / General","Antikalar ve Koleksiyon Ürünleri / Genel",""
"ANT056000","Antiques & Collectibles / Advertising","Antikalar ve Koleksiyon Ürünleri / Reklamcılık",""
"ANT002000","Antiques & Collectibles / Art","Antikalar ve Koleksiyon Ürünleri / Sanat Eserleri",""

Çeviri Özellikleri

  • 🚀 Yerel LibreTranslate Sunucusu: API hız sınırları veya harici bağımlılıklar yok
  • 📦 Docker Entegrasyonu: docker-compose up -d ile kolay kurulum
  • ⚡ Toplu İşleme: Optimal performans için grup başına 50 çeviri işler
  • 🔄 Otomatik Yeniden Deneme: Geçici ağ sorunlarını zarif bir şekilde halleder
  • 📊 İlerleme Takibi: Çeviri sırasında gerçek zamanlı ilerleme güncellemeleri
  • 🛡️ Yedek İşleme: Çeviri başarısız olursa orijinal metni kullanır

Hata Yönetimi

Script şunlar için kapsamlı hata yönetimi içerir:

  • Ağ bağlantı sorunları
  • HTTP yanıt hataları
  • HTML ayrıştırma hataları
  • Eksik DOM elementleri
  • Çeviri API hataları
  • Docker konteyner sorunları

Lisans

ISC Lisansı - detaylar için LICENSE dosyasına bakın.


Contributing / Katkıda Bulunma

Contributions are welcome! Please feel free to submit a Pull Request.

Katkılarınız memnuniyetle karşılanır! Lütfen Pull Request göndermekten çekinmeyin.

Support / Destek

If you encounter any issues or have questions, please open an issue on GitHub.

Herhangi bir sorunla karşılaşırsanız veya sorularınız varsa, lütfen GitHub'da bir issue açın.

About

BISG: Book Industry Study Group, BISAC: Subject Codes The Industry Standard in Categorization Scrapper

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages