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
This commit is contained in:
Louis Mylle
2026-07-19 20:05:49 +02:00
parent 4b65cbbe84
commit c6a69c6ada
10 changed files with 1075 additions and 6 deletions

View File

@@ -124,6 +124,12 @@ class MainWindow(QMainWindow):
exit_action.triggered.connect(self.close)
file_menu.addAction(exit_action)
# Mode menu - switch between the EBoek and Bookys scrapers
mode_menu = menubar.addMenu('Mode')
to_bookys_action = QAction('Switch to Bookys', self)
to_bookys_action.triggered.connect(self._switch_to_bookys)
mode_menu.addAction(to_bookys_action)
# Settings menu
settings_menu = menubar.addMenu('Settings')
@@ -138,6 +144,13 @@ class MainWindow(QMainWindow):
about_action.triggered.connect(self.show_about)
help_menu.addAction(about_action)
def _switch_to_bookys(self):
"""Switch to the Bookys scraper window."""
from PyQt5.QtWidgets import QApplication
app = QApplication.instance()
if hasattr(app, 'show_bookys'):
app.show_bookys()
def create_credential_section(self, parent_layout):
"""Create the credential management section."""
group = QGroupBox("Account Credentials")