Add title for idm output (#2871)

This commit is contained in:
the1812 2022-01-09 23:45:24 +08:00
parent f03829f945
commit 0325eac850
2 changed files with 3 additions and 2 deletions

View File

@ -1 +1 @@
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["video/download/idm-output"]=t():e["video/download/idm-output"]=t()}(self,(function(){return function(){"use strict";var e={d:function(t,o){for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t={};e.d(t,{plugin:function(){return r}});var o=coreApis.download,n=coreApis.utils.constants,i=coreApis.utils.title;const r={name:"downloadVideo.outputs.idm",displayName:"下载视频 - IDM 输出支持",description:"为下载视频增加 IDM 输出支持.",setup:({addData:e})=>{e("downloadVideo.outputs",(e=>{e.push({name:"idm",displayName:"IDM",description:"使用 IDM 的 .ef2 格式导出, 可以在 IDM 中使用导入开始下载. 请注意此导出方式不能保留视频文件名.",runAction:async e=>{const{infos:t}=e,r=document.URL.replace(window.location.search,""),d=t.map((e=>e.titledFragments.map((e=>`<\n${e.url}\nreferer: ${r}\nUser-Agent: ${n.UserAgent}\n>`.trim())))).flat().concat("").join("\n").replace(/([^\r])\n/g,"$1\r\n");await o.DownloadPackage.single(`${(0,i.getFriendlyTitle)()}.ef2`,d)}})}))},commitHash:"384f0531f678f48999772f4175fbc406bcbbd5e1"};return t=t.plugin}()}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["video/download/idm-output"]=t():e["video/download/idm-output"]=t()}(self,(function(){return function(){"use strict";var e={d:function(t,o){for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t={};e.d(t,{plugin:function(){return r}});var o=coreApis.download,n=coreApis.utils.constants,i=coreApis.utils.title;const r={name:"downloadVideo.outputs.idm",displayName:"下载视频 - IDM 输出支持",description:"为下载视频增加 IDM 输出支持.",setup:({addData:e})=>{e("downloadVideo.outputs",(e=>{e.push({name:"idm",displayName:"IDM",description:"使用 IDM 的 .ef2 格式导出, 可以在 IDM 中使用导入开始下载.",runAction:async e=>{const{infos:t}=e,r=document.URL.replace(window.location.search,""),a=t.map((e=>e.titledFragments.map((e=>`<\n${e.url}\nreferer: ${r}\nUser-Agent: ${n.UserAgent}\nfilename: ${e.title}\n>`.trim())))).flat().concat("").join("\n").replace(/([^\r])\n/g,"$1\r\n");await o.DownloadPackage.single(`${(0,i.getFriendlyTitle)()}.ef2`,a)}})}))},commitHash:"f03829f945fe9a1c82035ffcbf0c0b07a9657920"};return t=t.plugin}()}));

View File

@ -13,7 +13,7 @@ export const plugin: PluginMetadata = {
outputs.push({
name: 'idm',
displayName: 'IDM',
description: '使用 IDM 的 .ef2 格式导出, 可以在 IDM 中使用导入开始下载. 请注意此导出方式不能保留视频文件名.',
description: '使用 IDM 的 .ef2 格式导出, 可以在 IDM 中使用导入开始下载.',
runAction: async action => {
const { infos } = action
const referer = document.URL.replace(window.location.search, '')
@ -22,6 +22,7 @@ export const plugin: PluginMetadata = {
${f.url}
referer: ${referer}
User-Agent: ${UserAgent}
filename: ${f.title}
>`.trim()
))).flat()
const input = items.concat('').join('\n').replace(/([^\r])\n/g, '$1\r\n')