Files
eboek.info-scraper/scripts/build_exe.bat
Louis Mylle c6a69c6ada feat: Add Bookys scraper alongside EBoek with startup mode chooser
Adds a second scraper for bookys-ebooks.com that harvests direct 1fichier
download URLs into a .txt file. The existing EBoek scraper core is unchanged;
only the GUI gained a Mode menu entry to switch between the two.

Bookys specifics:
- Visible (never headless) browser, since the site is behind Cloudflare.
  The challenge is auto-detected: the scraper polls for real listing items
  and continues on its own once it clears, no button needed.
- Persistent Chrome profile in ~/.eboek_scraper/bookys_chrome_profile so the
  Cloudflare clearance cookie survives between runs. Removed the hardcoded
  user-agent override, which claimed Chrome/120 against a real Chrome/150 and
  invalidated that cookie on every launch.
- Pop-up ads are avoided by never clicking host links: hrefs are read and
  navigated to directly, with window.open neutered via CDP as a backstop.
- Host links are read with textContent rather than Selenium's .text, which
  returns empty for these elements because they sit in a collapsed container.
- Only 1fichier hosts are followed; other hosts on a page are ignored.

Build configs list the new modules as hidden imports in all four places.
gui_main imports the Bookys window lazily, so PyInstaller's static analysis
would otherwise miss it and the .exe would crash on switching modes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NVJc2XuTvqBHSuqotetseS
2026-07-19 20:05:49 +02:00

95 lines
2.7 KiB
Batchfile

@echo off
REM Build script for EBoek.info Scraper Windows executable
REM Run this script to compile the application into a standalone .exe file
echo =====================================
echo Building EBoek.info Scraper
echo =====================================
echo.
REM Check if PyInstaller is installed
python -m PyInstaller --version >nul 2>&1
if errorlevel 1 (
echo Installing PyInstaller...
python -m pip install pyinstaller
echo.
) else (
echo PyInstaller found
echo.
)
REM Clean previous builds
if exist "dist" rmdir /s /q "dist"
if exist "build" rmdir /s /q "build"
echo Cleaned previous builds
echo.
REM Option 1: Quick build (single file executable)
echo Building single-file executable...
echo This may take a few minutes...
echo.
python -m pyinstaller --onefile --windowed --name "EBoek_Scraper" ^
--hidden-import "PyQt5.QtCore" ^
--hidden-import "PyQt5.QtGui" ^
--hidden-import "PyQt5.QtWidgets" ^
--hidden-import "selenium" ^
--hidden-import "selenium.webdriver" ^
--hidden-import "selenium.webdriver.chrome" ^
--hidden-import "core.scraper" ^
--hidden-import "core.scraper_thread" ^
--hidden-import "core.credentials" ^
--hidden-import "gui.main_window" ^
--hidden-import "gui.login_dialog" ^
--hidden-import "gui.progress_dialog" ^
--hidden-import "utils.validators" ^
--hidden-import "core.bookys_scraper" ^
--hidden-import "core.bookys_thread" ^
--hidden-import "gui.bookys_window" ^
--hidden-import "gui.startup_dialog" ^
--exclude-module "tkinter" ^
--exclude-module "matplotlib" ^
..\gui_main.py
if errorlevel 1 (
echo.
echo BUILD FAILED! Trying alternative method...
echo.
REM Option 2: Use spec file
echo Building with spec file...
python -m pyinstaller eboek_scraper.spec
if errorlevel 1 (
echo BUILD FAILED!
echo Please check the error messages above.
pause
exit /b 1
)
)
echo.
echo =====================================
echo BUILD SUCCESSFUL!
echo =====================================
echo.
echo Your Windows executable is located at:
echo dist\EBoek_Scraper.exe
echo.
echo Verifying file exists...
if exist "dist\EBoek_Scraper.exe" (
echo ✓ EBoek_Scraper.exe found
for %%f in ("dist\EBoek_Scraper.exe") do echo File size: %%~zf bytes
) else (
echo ❌ EBoek_Scraper.exe not found - build may have failed
)
echo.
echo ============================================
echo 🎉 Ready for Windows distribution!
echo ============================================
echo • Share the file: dist\EBoek_Scraper.exe
echo • No Python installation required on target PC
echo • Windows may show security warning on first run
echo (Click "More Info""Run Anyway")
echo.
pause