]>
Commit | Line | Data |
---|---|---|
bc22d608 | 1 | |
d4681c00 | 2 | import { VideoImportCreate } from '../../models/videos' |
d175a6f7 | 3 | import { makeGetRequest, makeUploadRequest } from '../requests/requests' |
590fb506 C |
4 | |
5 | function getYoutubeVideoUrl () { | |
6 | return 'https://youtu.be/msX3jv1XdvM' | |
7 | } | |
8 | ||
187501f8 C |
9 | function getMagnetURI () { |
10 | // tslint:disable:max-line-length | |
3e17515e | 11 | return 'magnet:?xs=https%3A%2F%2Fpeertube2.cpy.re%2Fstatic%2Ftorrents%2Fb209ca00-c8bb-4b2b-b421-1ede169f3dbc-720.torrent&xt=urn:btih:0f498834733e8057ed5c6f2ee2b4efd8d84a76ee&dn=super+peertube2+video&tr=wss%3A%2F%2Fpeertube2.cpy.re%3A443%2Ftracker%2Fsocket&tr=https%3A%2F%2Fpeertube2.cpy.re%2Ftracker%2Fannounce&ws=https%3A%2F%2Fpeertube2.cpy.re%2Fstatic%2Fwebseed%2Fb209ca00-c8bb-4b2b-b421-1ede169f3dbc-720.mp4' |
187501f8 C |
12 | } |
13 | ||
dc133480 C |
14 | function getBadVideoUrl () { |
15 | return 'https://download.cpy.re/peertube/bad_video.mp4' | |
16 | } | |
17 | ||
590fb506 C |
18 | function importVideo (url: string, token: string, attributes: VideoImportCreate) { |
19 | const path = '/api/v1/videos/imports' | |
20 | ||
187501f8 C |
21 | let attaches: any = {} |
22 | if (attributes.torrentfile) attaches = { torrentfile: attributes.torrentfile } | |
23 | ||
24 | return makeUploadRequest({ | |
590fb506 C |
25 | url, |
26 | path, | |
27 | token, | |
187501f8 | 28 | attaches, |
590fb506 C |
29 | fields: attributes, |
30 | statusCodeExpected: 200 | |
31 | }) | |
32 | } | |
33 | ||
3e17515e | 34 | function getMyVideoImports (url: string, token: string, sort?: string) { |
590fb506 C |
35 | const path = '/api/v1/users/me/videos/imports' |
36 | ||
3e17515e C |
37 | const query = {} |
38 | if (sort) query['sort'] = sort | |
39 | ||
590fb506 C |
40 | return makeGetRequest({ |
41 | url, | |
3e17515e | 42 | query, |
590fb506 C |
43 | path, |
44 | token, | |
45 | statusCodeExpected: 200 | |
46 | }) | |
47 | } | |
48 | ||
49 | // --------------------------------------------------------------------------- | |
50 | ||
51 | export { | |
dc133480 | 52 | getBadVideoUrl, |
590fb506 C |
53 | getYoutubeVideoUrl, |
54 | importVideo, | |
187501f8 | 55 | getMagnetURI, |
590fb506 C |
56 | getMyVideoImports |
57 | } |