parent
6da404f359
commit
dd33a4f64c
@ -0,0 +1,36 @@
|
||||
# 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
|
||||
|
||||
|
||||
# useful for handling different item types with a single interface
|
||||
from itemadapter import ItemAdapter
|
||||
import subprocess
|
||||
|
||||
|
||||
# fdata = pd.read_csv(fpath,encoding='gb18030')
|
||||
class BilibiliSpiderPipeline:
|
||||
def process_item(self, item, spider):
|
||||
title = item['title']
|
||||
audio_content = item['video_mp3']
|
||||
vedio_content = item['video_mp4']
|
||||
content_list = item['content_list']
|
||||
print(title)
|
||||
|
||||
# # 保存视频并合成处理
|
||||
# with open('video\\' + title + '.mp3', mode='wb') as f:
|
||||
# f.write(audio_content)
|
||||
# with open('video\\' + title + '.mp4', mode='wb') as f:
|
||||
# f.write(vedio_content)
|
||||
#
|
||||
# COMMAND = f'ffmpeg -i video\\{title}.mp4 -i video\\{title}.mp3 -c:v copy -c:a aac -strict experimental video\\{title}output.mp4'
|
||||
# subprocess.run(COMMAND, shell=True)
|
||||
#
|
||||
# # 保存弹幕
|
||||
# for content in content_list:
|
||||
# with open('barrage\\' + title + 'barrage.txt', mode='a', encoding='utf-8') as f:
|
||||
# f.write(content)
|
||||
# f.write('\n')
|
||||
|
||||
return item
|
Loading…
Reference in new issue