mirror of https://github.com/Chocobozzz/PeerTube
Fix video import of some youtube videos
parent
542e73a26b
commit
cc68049424
|
@ -32,7 +32,7 @@ export class MenuComponent implements OnInit {
|
|||
private serverService: ServerService,
|
||||
private redirectService: RedirectService,
|
||||
private themeService: ThemeService,
|
||||
private hotkeysService: HotkeysService
|
||||
private hotkeysService: HotkeysService
|
||||
) {}
|
||||
|
||||
ngOnInit () {
|
||||
|
|
|
@ -18,6 +18,10 @@ export type YoutubeDLInfo = {
|
|||
thumbnailUrl?: string
|
||||
}
|
||||
|
||||
const processOptions = {
|
||||
maxBuffer: 1024 * 1024 * 10 // 10MB
|
||||
}
|
||||
|
||||
function getYoutubeDLInfo (url: string, opts?: string[]): Promise<YoutubeDLInfo> {
|
||||
return new Promise<YoutubeDLInfo>(async (res, rej) => {
|
||||
const options = opts || [ '-j', '--flat-playlist' ]
|
||||
|
@ -44,7 +48,7 @@ function downloadYoutubeDLVideo (url: string) {
|
|||
|
||||
return new Promise<string>(async (res, rej) => {
|
||||
const youtubeDL = await safeGetYoutubeDL()
|
||||
youtubeDL.exec(url, options, err => {
|
||||
youtubeDL.exec(url, options, processOptions, err => {
|
||||
if (err) return rej(err)
|
||||
|
||||
return res(path)
|
||||
|
|
Loading…
Reference in New Issue