You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
644 B
22 lines
644 B
# Define your item pipelines here
|
|
#
|
|
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
|
|
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
|
|
|
|
|
|
import re
|
|
|
|
# useful for handling different item types with a single interface
|
|
from itemadapter import ItemAdapter
|
|
from scrapy.pipelines.files import FilesPipeline
|
|
|
|
|
|
class HedgedocExporterPipeline:
|
|
def process_item(self, item, spider):
|
|
return item
|
|
|
|
class PageFilesPipeline(FilesPipeline):
|
|
def file_path(self, request, response=None, info=None, *, item=None):
|
|
name = re.search(r'/(.*?)/download$', request.url).groups()[0]
|
|
return f'{name}.md'
|