diff --git a/.gitignore b/.gitignore
index 575c1ad..34e8a05 100644
--- a/.gitignore
+++ b/.gitignore
@@ -174,3 +174,5 @@ cython_debug/
# PyPI configuration file
.pypirc
+
+media/
diff --git a/celerybeat-schedule.db b/celerybeat-schedule.db
new file mode 100644
index 0000000..e69de29
diff --git a/crawler/admin.py b/crawler/admin.py
index b738c61..c891f8d 100644
--- a/crawler/admin.py
+++ b/crawler/admin.py
@@ -83,7 +83,7 @@ class CrawledContentAdmin(admin.ModelAdmin):
def preview_content(self, obj):
"""预览内容"""
if obj.is_local_saved:
- url = reverse('admin:crawled_content_preview', args=[obj.id])
+ url = reverse('preview_crawled_content', args=[obj.id])
return format_html(
'预览文章',
url
diff --git a/crawler/templates/crawler/dashboard.html b/crawler/templates/crawler/dashboard.html
index 348059c..5114a79 100644
--- a/crawler/templates/crawler/dashboard.html
+++ b/crawler/templates/crawler/dashboard.html
@@ -186,6 +186,9 @@
{% endif %}
+
+
+
{% for keyword in content.keywords_matched|split:"," %}
{{ keyword|strip }}
{% endfor %}
diff --git a/crawler/urls.py b/crawler/urls.py
index 0c34da0..03bb32b 100644
--- a/crawler/urls.py
+++ b/crawler/urls.py
@@ -5,4 +5,5 @@ urlpatterns = [
path('', views.dashboard, name='dashboard'),
path('search/', views.search_page, name='search'),
path('crawled-content/
/preview/', views.preview_crawled_content, name='preview_crawled_content'),
+ path('crawled-content//download/', views.download_crawled_content, name='download_crawled_content'),
]
\ No newline at end of file
diff --git a/crawler/views.py b/crawler/views.py
index 70312f3..60ec1ba 100644
--- a/crawler/views.py
+++ b/crawler/views.py
@@ -1,9 +1,10 @@
from django.shortcuts import render, get_object_or_404
-from django.http import HttpResponse
+from django.http import HttpResponse, Http404
from django.db.models import Q, Count
from django.conf import settings
from django.utils import timezone
-from .models import Website, CrawlTask, CrawledContent, CrawlLog, SearchKeyword
+from django.core.files.storage import default_storage
+from .models import Website, CrawlTask, CrawledContent, CrawlLog, SearchKeyword, MediaFile
from rest_framework import viewsets, filters
from rest_framework.decorators import action
from rest_framework.response import Response
@@ -15,6 +16,12 @@ import json
from django.core.paginator import Paginator
from django.db.models.functions import TruncDate
from django.db.models import Count
+import os
+import tempfile
+import zipfile
+from io import BytesIO
+from docx import Document
+from django.core.files.base import ContentFile
def dashboard(request):
@@ -289,4 +296,62 @@ def preview_crawled_content(request, content_id):