Mercurial > silorider
view silorider/silos/webmention.py @ 28:69a6a8c9d33d
Fix article feed not being found for some markups
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 19 Apr 2023 12:48:25 -0700 |
parents | d3c4c5082bbc |
children | 947bd8643e12 |
line wrap: on
line source
import logging import ronkyuu from .base import Silo from ..config import has_lxml logger = logging.getLogger(__name__) class WebmentionSilo(Silo): SILO_TYPE = 'webmention' def __init__(self, ctx): super().__init__(ctx) self.client = None ronkyuu.setParser('lxml' if has_lxml else 'html5lib') def authenticate(self, ctx): logger.info("Webmention silo doesn't require authentication.") def postEntry(self, entry, ctx): source_url = entry.url logger.debug("Finding mentions in: %s" % source_url) refs = ronkyuu.findMentions(source_url) for r in refs.get('refs', []): logger.debug("Sending webmention: %s -> %s" % (source_url, r)) ronkyuu.sendWebmention(source_url, r)