output to out/feeds/*
This commit is contained in:
parent
beac981047
commit
6fd3b598ab
11 changed files with 298 additions and 16 deletions
|
|
@ -8,7 +8,7 @@ from scrapy.utils.spider import iterate_spider_output
|
|||
|
||||
from repub.items import ChannelElementItem, ElementItem
|
||||
from repub.rss import CDATA, CONTENT, ITUNES, MEDIA, E, munge_cdata_html, normalize_date
|
||||
from repub.utils import FileType, determine_file_type, local_file_path
|
||||
from repub.utils import FileType, determine_file_type, local_file_path, local_image_path
|
||||
|
||||
|
||||
class BaseRssFeedSpider(Spider):
|
||||
|
|
@ -34,13 +34,15 @@ class BaseRssFeedSpider(Spider):
|
|||
|
||||
def rewrite_file_url(self, file_type: FileType, url):
|
||||
file_dir = self.settings["REPUBLISHER_FILE_DIR"]
|
||||
local_path = local_file_path(url)
|
||||
if file_type == FileType.IMAGE:
|
||||
file_dir = self.settings["REPUBLISHER_IMAGE_DIR"]
|
||||
local_path = local_image_path(url)
|
||||
elif file_type == FileType.VIDEO:
|
||||
file_dir = self.settings["REPUBLISHER_VIDEO_DIR"]
|
||||
elif file_type == FileType.AUDIO:
|
||||
file_dir = self.settings["REPUBLISHER_AUDIO_DIR"]
|
||||
return f"/{file_dir}/{local_file_path(url)}"
|
||||
return f"{file_dir}/{local_path}"
|
||||
|
||||
def rewrite_image_url(self, url):
|
||||
return self.rewrite_file_url(FileType.IMAGE, url)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue