mirror of
https://github.com/thecyberlearn/chat-backend.git
synced 2026-08-18 14:32:53 +00:00
Features: - Django REST API backend - Multi-strategy web scraping system (Beautiful Soup, Playwright, Firecrawl) - Anti-detection features (proxy rotation, user-agent rotation) - Data export functionality (JSON, CSV, TXT) - Business and CrawledPage models - Enhanced crawling service with fallback mechanisms 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
23 lines
714 B
Python
23 lines
714 B
Python
from django.http import Http404
|
||
from django.utils.translation import gettext as _
|
||
|
||
|
||
def feed(request, url, feed_dict=None):
|
||
"""Provided for backwards compatibility."""
|
||
if not feed_dict:
|
||
raise Http404(_("No feeds are registered."))
|
||
|
||
slug = url.partition("/")[0]
|
||
try:
|
||
f = feed_dict[slug]
|
||
except KeyError:
|
||
raise Http404(_("Slug %r isn’t registered.") % slug)
|
||
|
||
instance = f()
|
||
instance.feed_url = getattr(f, "feed_url", None) or request.path
|
||
instance.title_template = f.title_template or ("feeds/%s_title.html" % slug)
|
||
instance.description_template = f.description_template or (
|
||
"feeds/%s_description.html" % slug
|
||
)
|
||
return instance(request)
|