dosage icon indicating copy to clipboard operation
dosage copied to clipboard

Update l.py for fixing Least I Could Do and adding Sunday's Least I Could Do Beginnings

Open scouchman opened this issue 6 months ago • 2 comments

Fix LICD scrapers for new Elementor layout

  • Updated both LeastICouldDo and LeastICouldDoBeginnings
  • Site redesign removed comic/comic-beginnings CSS classes
  • Now targets Elementor widget container and filters by URL pattern
  • Added desktop-scaled filter to avoid multiple image warnings

scouchman avatar Oct 21 '25 20:10 scouchman

Add LeastICouldDoBeginnings scraper and fix LICD for new site layout

This PR addresses two issues with Least I Could Do:

1. Add Sunday "Beginnings" strips support (New Feature)

Fixes #285 - Sunday strips were previously inaccessible (I had put in a code request before, but LICD site then broke about a week later)

The existing LeastICouldDo scraper couldn't handle Sunday strips because they are a completely separate series called "Beginnings" that uses different CSS classes and URLs.

Solution:

  • Added new LeastICouldDoBeginnings scraper
  • Automatically calculates most recent Sunday as starting point
  • Separate from regular daily strips (Monday-Saturday)
  • Creates its own LeastICouldDoBeginnings folder

2. Fix both scrapers for new Elementor layout (Bug Fix)

The site recently migrated to Elementor page builder, breaking both scrapers.

What broke:

  • Removed comic and comic-beginnings CSS classes
  • Removed latest-comic link from homepage
  • Changed to generic Elementor widget containers

Solution:

  • Both scrapers now target Elementor widget image containers
  • Filter by URL pattern: "licd" for regular, "beg" for Beginnings
  • Added "desktop-scaled" filter to select full-size images only
  • Regular LICD now dynamically calculates today's date (skips Sundays)
  • Removed broken latestSearch and indirectStarter

Code Changes:

LeastICouldDo scraper:

  • Uses @property decorator to dynamically calculate today's URL
  • Skips Sundays automatically (goes to Saturday instead)
  • XPath: //div[contains(@class, "elementor-widget-image")]//img[contains(@src, "licd") and contains(@src, "desktop-scaled")]

LeastICouldDoBeginnings scraper (NEW):

  • Uses @property decorator to find most recent Sunday
  • Starts from first Sunday strip (Nov 9, 2008)
  • XPath: //div[contains(@class, "elementor-widget-image")]//img[contains(@src, "beg") and contains(@src, "desktop-scaled")]

Testing:

  • [x] LeastICouldDo downloads today's weekday strip without warnings
  • [x] LeastICouldDoBeginnings downloads most recent Sunday strip
  • [x] Both follow prev links correctly
  • [x] No multiple image warnings (desktop-scaled filter works)
  • [x] Resolves issue #285 (Sunday strips now accessible)
  • [x] Creates separate folder structure for Beginnings

Usage:

# Regular weekday strips (Mon-Sat)
dosage LeastICouldDo

# Sunday "Beginnings" strips
dosage LeastICouldDoBeginnings

Both scrapers now work correctly with the new Elementor-based site layout.

scouchman avatar Oct 21 '25 20:10 scouchman

That makes no sense since both comics are still on the same navigation (but beginnings has busted navigation, so it's probably not possible to build a working module for it), so you will end up with either a bunch of errors when comic pages don't match or you have almost the same images in both modules. Additionally, guessing URLs from the current day is totally brittle and should never be done. You should always "navigate" from a known (stable) URL to the latest comic.

And please don't pad your submission with AI slop.

TobiX avatar Oct 25 '25 21:10 TobiX

Closing for now, as noted in https://github.com/webcomics/dosage/issues/285#issuecomment-3447841488

TobiX avatar Nov 26 '25 15:11 TobiX