Tighten lnw comments and log form after review (#87)
Cross-reference lnwChapterRe from the function doc instead of restating its rationale, drop the redundant '; skipping' from the fail-closed log to match the package's bare verb:detail form, and reword the truncation comment so the logged body length is not described as a code-made distinction.
This commit is contained in:
@@ -98,11 +98,7 @@ const lnwCommentMarker = "wpd-threads"
|
||||
// such guarantee — demonicChapterRe matches any chaptered.php?manga=<id> anchor
|
||||
// with no per-series scoping, because the stored series_id for demonic is a
|
||||
// slug, not the numeric id the URL carries, so it cannot easily be scoped.
|
||||
// lightnovelworld is unscoped for a stronger reason: its chapter addresses
|
||||
// carry the Chapter Slug, which is not the Series identity, so no stored-slug
|
||||
// pattern can cover a Series' whole list (see lnwChapterRe). Instead of
|
||||
// scoping, its branch scans only the body before the comment thread marker and
|
||||
// skips the page when the marker is absent.
|
||||
// lightnovelworld is unscoped and body-truncated instead — see lnwChapterRe.
|
||||
func latestChapterFrom(site, seriesURL, body string) (latestChapter, bool) {
|
||||
var re *regexp.Regexp
|
||||
switch site {
|
||||
@@ -151,11 +147,11 @@ func latestChapterFrom(site, seriesURL, body string) (latestChapter, bool) {
|
||||
// page any visitor can write to, so the scan never reads past it (see
|
||||
// lnwChapterRe). A body without the marker is skipped, never scanned
|
||||
// whole — a redesign must degrade into staleness, not into a wrong
|
||||
// shared value. The body length distinguishes a genuine markup change
|
||||
// from a body the size cap cut short.
|
||||
// shared value; the logged body length tells a markup change from a
|
||||
// body the size cap cut short.
|
||||
i := strings.Index(body, lnwCommentMarker)
|
||||
if i < 0 {
|
||||
log.Printf("latest poll %q: no %s marker in %d bytes; skipping", seriesURL, lnwCommentMarker, len(body))
|
||||
log.Printf("latest poll %q: no %s marker in %d bytes", seriesURL, lnwCommentMarker, len(body))
|
||||
return latestChapter{}, false
|
||||
}
|
||||
body = body[:i]
|
||||
|
||||
Reference in New Issue
Block a user