diff options
author | Chocobozzz <me@florianbigard.com> | 2020-12-14 09:54:38 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-12-14 09:55:30 +0100 |
commit | 5721fd8374e732c4dfa149c54a800db74591c245 (patch) | |
tree | de9b569ebd008f15336bcb0d6266bc2baec4f1b6 /server/tools | |
parent | d8794cf85554a17e1f110f49a0c965be825a9b4a (diff) | |
download | PeerTube-5721fd8374e732c4dfa149c54a800db74591c245.tar.gz PeerTube-5721fd8374e732c4dfa149c54a800db74591c245.tar.zst PeerTube-5721fd8374e732c4dfa149c54a800db74591c245.zip |
Fix channels import with a channel with playlists
Diffstat (limited to 'server/tools')
-rw-r--r-- | server/tools/peertube-import-videos.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index 1b2c63af2..5fc5a867c 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts | |||
@@ -74,10 +74,15 @@ async function run (url: string, user: UserInfo) { | |||
74 | 74 | ||
75 | let info = await getYoutubeDLInfo(youtubeDL, program['targetUrl'], command.args) | 75 | let info = await getYoutubeDLInfo(youtubeDL, program['targetUrl'], command.args) |
76 | 76 | ||
77 | if (info?.title === 'Uploads') { | 77 | if (!Array.isArray(info)) info = [ info ] |
78 | console.log('Fixing URL to %s.', info.url) | ||
79 | 78 | ||
80 | info = await getYoutubeDLInfo(youtubeDL, info.url, command.args) | 79 | // Try to fix youtube channels upload |
80 | const uploadsObject = info.find(i => !i.ie_key && !i.duration && i.title === 'Uploads') | ||
81 | |||
82 | if (uploadsObject) { | ||
83 | console.log('Fixing URL to %s.', uploadsObject.url) | ||
84 | |||
85 | info = await getYoutubeDLInfo(youtubeDL, uploadsObject.url, command.args) | ||
81 | } | 86 | } |
82 | 87 | ||
83 | let infoArray: any[] | 88 | let infoArray: any[] |