Skip to content

Update MangaTV extension with resilient selectors and anti-blocking headers#1

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/update-mangatv-extension
Draft

Update MangaTV extension with resilient selectors and anti-blocking headers#1
Copilot wants to merge 4 commits into
mainfrom
copilot/update-mangatv-extension

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 15, 2026

The MangaTV extension fails to scrape mangatv.net due to outdated single-path selectors and inadequate HTTP headers triggering anti-bot measures.

Changes

Core resilience improvements

  • Multiple selector fallbacks: Each scraping method now tries 4-7 CSS selectors instead of 1, exiting on first match
  • Enhanced HTTP headers: Added Accept, Accept-Language, Accept-Encoding, Origin to mimic browser behavior
  • Error boundaries: Wrapped all async methods in try-catch with structured logging

Performance optimizations

  • Replaced O(n²) Array.includes() with Set for image deduplication in getChapterDetails
  • Extracted magic constant MAX_HOMEPAGE_ITEMS = 20

Example selector fallback pattern

const selectors = [
    "ul.clstyle li",           // Current site structure
    "div.eplister ul li",      // Common alternative
    "div.chapter-list li",     // Legacy format
    "ul.chapters li",          // Generic fallback
    "div.chapterlist li"
];

for (const selector of selectors) {
    const elements = $(selector);
    if (elements.length > 0) {
        console.log(`Found ${elements.length} chapters using: ${selector}`);
        // Process elements...
        break;
    }
}

Additional files

  • Created package.json with dependencies
  • Rewrote README.md with architecture overview and troubleshooting guide
Original prompt

Actualizar la extensión MangaTV para que funcione correctamente con mangatv.net

Problema actual:

La extensión MangaTV tiene selectores HTML desactualizados que no coinciden con la estructura actual del sitio web, causando que la extensión no pueda scrappear datos correctamente.

Solución:

  1. Reemplazar el archivo 0.8/MangaTV/index.js con código mejorado que incluya:

    • Headers HTTP adecuados para evitar bloqueos
    • Múltiples selectores CSS para mayor compatibilidad
    • Mejor manejo de errores
    • Soporte para múltiples formatos de URL
    • Extracción de información más robusta
  2. Agregar archivo 0.8/MangaTV/package.json con las dependencias necesarias

  3. Mejorar el archivo 0.8/MangaTV/README.md con instrucciones más detalladas

Cambios específicos:

  • Mejorar constructor con headers completos
  • Agregar selectores alternativos en getMangaDetails, getChapters, getChapterDetails
  • Implementar try-catch para mejor manejo de errores
  • Optimizar getHomePageSections y getSearchResults
  • Asegurar normalización correcta de URLs de imágenes
  • Agregar logging para debugging

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits February 15, 2026 03:37
Co-authored-by: WiLyDTG <74471949+WiLyDTG@users.noreply.github.com>
…ility

Co-authored-by: WiLyDTG <74471949+WiLyDTG@users.noreply.github.com>
Co-authored-by: WiLyDTG <74471949+WiLyDTG@users.noreply.github.com>
Copilot AI changed the title [WIP] Update MangaTV extension for compatibility with mangatv.net Update MangaTV extension with resilient selectors and anti-blocking headers Feb 15, 2026
Copilot AI requested a review from WiLyDTG February 15, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants