diff options
-rw-r--r-- | server/tools/peertube-import-videos.ts | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index d91767c29..9be0834ba 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts | |||
@@ -1,20 +1,18 @@ | |||
1 | import { registerTSPaths } from '../helpers/register-ts-paths' | 1 | import { registerTSPaths } from '../helpers/register-ts-paths' |
2 | registerTSPaths() | 2 | registerTSPaths() |
3 | 3 | ||
4 | import { accessSync, constants } from 'fs' | ||
5 | import { join } from 'path' | ||
6 | import { promisify } from 'util' | ||
7 | |||
8 | import * as program from 'commander' | 4 | import * as program from 'commander' |
5 | import { accessSync, constants } from 'fs' | ||
9 | import { remove } from 'fs-extra' | 6 | import { remove } from 'fs-extra' |
10 | import { truncate } from 'lodash' | 7 | import { truncate } from 'lodash' |
8 | import { join } from 'path' | ||
11 | import * as prompt from 'prompt' | 9 | import * as prompt from 'prompt' |
12 | 10 | import { promisify } from 'util' | |
13 | import { doRequestAndSaveToFile } from '../helpers/requests' | 11 | import { advancedVideosSearch, getClient, getVideoCategories, login, uploadVideo } from '../../shared/extra-utils/index' |
14 | import { CONSTRAINTS_FIELDS } from '../initializers/constants' | ||
15 | import { getClient, getVideoCategories, login, searchVideoWithSort, uploadVideo } from '../../shared/extra-utils/index' | ||
16 | import { sha256 } from '../helpers/core-utils' | 12 | import { sha256 } from '../helpers/core-utils' |
13 | import { doRequestAndSaveToFile } from '../helpers/requests' | ||
17 | import { buildOriginallyPublishedAt, getYoutubeDLVideoFormat, safeGetYoutubeDL } from '../helpers/youtube-dl' | 14 | import { buildOriginallyPublishedAt, getYoutubeDLVideoFormat, safeGetYoutubeDL } from '../helpers/youtube-dl' |
15 | import { CONSTRAINTS_FIELDS } from '../initializers/constants' | ||
18 | import { buildCommonVideoOptions, buildVideoAttributesFromCommander, getLogger, getServerCredentials } from './cli' | 16 | import { buildCommonVideoOptions, buildVideoAttributesFromCommander, getLogger, getServerCredentials } from './cli' |
19 | 17 | ||
20 | type UserInfo = { | 18 | type UserInfo = { |
@@ -150,7 +148,7 @@ async function processVideo (parameters: { | |||
150 | return | 148 | return |
151 | } | 149 | } |
152 | 150 | ||
153 | const result = await searchVideoWithSort(url, videoInfo.title, '-match') | 151 | const result = await advancedVideosSearch(url, { search: videoInfo.title, sort: '-match', searchTarget: 'local' }) |
154 | 152 | ||
155 | log.info('############################################################\n') | 153 | log.info('############################################################\n') |
156 | 154 | ||