-
Notifications
You must be signed in to change notification settings - Fork 31
/
openapi.yaml
828 lines (825 loc) · 24 KB
/
openapi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
openapi: 3.1.0
info:
title: LiveTorrentBackend'
version: 2.0.0
contact:
name: Davenchy
url: https://github.com/Davenchy
email: [email protected]
license:
name: MIT
url: https://raw.githubusercontent.com/Davenchy/live-torrent-backend/master/LICENSE
tags:
- name: Search
description: The torrent content search API
- name: Torrent
description: Access torrent content.
- name: Subtitles
description: (BETA) Search and download subtitles from OpenSubtitles.
components:
examples:
SintelTorrentId:
summary: Sintel Torrent Id
description: The torrent info hash of the Sintel movie.
value: 08ada5a7a6183aae1e09d831df6748d566095a10
TorrentMeta:
summary: Torrent Meta
description: Sintel Torrent Meta File
value:
name: Sintel
length: 129302391
progress: 1
speed: 25192
downloaded: 129302391
eta: 0
completed: true
peers: 7
ratio: 0.025976500476341695
files:
- index: 0
name: Sintel.de.srt
length: 1652
path: Sintel/Sintel.de.srt
progress: 1
downloaded: 165
- index: 1
name: Sintel.en.srt
length: 1514
path: Sintel/Sintel.en.srt
progress: 0.296
downloaded: 448
- ...
TorrentFile:
summary: Torrent File
description: Sintel.en.srt File
value:
index: 1
name: Sintel.en.srt
length: 1514
path: Sintel/Sintel.en.srt
progress: 0.296
downloaded: 448
TorrentResult:
summary: Torrent Search Result
value:
title: "Spider-Man: No Way Home 720p"
time: "2022-03-11 16:14:44"
size: "1.33 GB"
description: "https://yts.mx/movies/spider-man-no-way-home-2021"
provider: Yts
peers: 19
seeds: 100
link: "https://yts.mx/torrent/download/4AC05990388D6C9654255011FC29D389AC67EC95"
magnet: "magnet:?xt=urn:btih:B54741D8982F1AC9E4C1EA645EA41E4F5E75862B&dn=Spider-Man%3A+No+Way+Home+%282021%29+%5B3D%5D+%5BYTS.MX%5D&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fopen.tracker.cl%3A1337%2Fannounce&tr=udp%3A%2F%2Fp4p.arenabg.com%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce&tr=udp%3A%2F%2Ftracker.dler.org%3A6969%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Fipv4.tracker.harry.lu%3A80%2Fannounce&tr=https%3A%2F%2Fopentracker.i2p.rocks%3A443%2Fannounce"
SubtitleSearchResult:
summary: A subtitle search result
value:
pages: 1
page: 1
limit: 50
count: 1
data:
- id: 1948575
type: subtitle
language: ar
downloads: 3137
hd: false
fps: 0
votes: 0
ratings: 0
trusted: false
ai_translated: false
machine_translated: false
url: "https://www.opensubtitles.com/ar/subtitles/legacy/5896597"
uploader:
id: 3282
name: os-auto
rank: Application Developers
details:
id: 53235
type: Episode
year: 2001
title: "Ready, Willing, and Disabled"
name: "Family Guy - S03E15 Ready, Willing, and Disabled"
imdb_id: 576960
tmdb_id: 66078
season: 3
episode: 15
parent_imdb_id: 182576
parent_title: Family Guy
InvalidTorrentIdError:
summary: Invalid/Missing TorrentId
description: TorrentId is missing or invalid, use hash param and id query to set a valid one.
value:
code: 1
error: Required valid id query or hash param
NoFileSelectionError:
summary: A selected file is required
description: |
To achive this request you have to select a single file, use **i** to select file by index or **q** to select a file using a fuzzy-finding query.
value:
code: 2
error: File selection is required, use query q or i to select one.
FileNotFoundError:
summary: File Not Found
description: The requested file is not found.
value:
code: 0
error: File Not Found!
RequiredSearchQueryError:
summary: Search Query Missing
description: The **q** query is missing.
value:
code: 4
error: query is required!
UnsupportedProviderError:
summary: Unsupported Provider
description: You are using an unsupported provider
value:
code: 5
error: Unsupported ThePiratePay provider
parameters:
TorrentId:
name: id
in: query
description: The torrentId/infoHash of the torrent file
required: true
schema:
type: string
examples:
Default:
$ref: '#/components/examples/SintelTorrentId'
TorrentInfoHash:
name: hash
in: path
required: true
description: The infoHash of the torrent file
schema:
type: string
examples:
Default:
$ref: '#/components/examples/SintelTorrentId'
PickFileQuery:
name: q
in: query
description: Use to fuzzy-find a file/s and select.
schema:
type: string
examples:
Nothing:
summary: Pick nothing
value: ''
Videos:
summary: "Pick all .mp4 video files"
value: '*.mp4'
Subtitles:
summary: "Pick all .srt subtitle files"
value: '*.srt'
PickFileIndex:
name: i
in: query
description: Use file index to pick
schema:
type: array
items:
type: number
examples:
Nothing:
summary: "Pick nothing"
value: ''
ManyFiles:
summary: "Pick indexes 0, 1, 2, and 3"
value: 0,1,2,3
SingleFile:
summary: "Pick the 3rd file"
value: 2
Image:
summary: "Pick the 10th file, The image"
value: 10
responses:
TorrentMeta:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/TorrentMeta'
examples:
Default:
$ref: '#/components/examples/TorrentMeta'
TorrentMetaError:
description: Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
InvalidTorrentId:
$ref: '#/components/examples/InvalidTorrentIdError'
NoFileSelection:
$ref: '#/components/examples/NoFileSelectionError'
FileServeOK:
description: OK
content:
application/octet-stream:
schema:
type: string
format: binary
example:
Served File Content!
FileServeError:
description: Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
code: 2
error: "File selection is required, use query: q or i to select one."
FileServeNotFoundError:
description: File Not Found Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
code: 0
error: "File Not Found!"
schemas:
SearchProvider:
description: A torrent search engine that provides torrent magnets.
type: object
required:
- name
- categories
properties:
name:
type: string
description: The provider name
categories:
type: array
items:
type: string
description: The supported categories by the provider
examples:
- name: Yts
categories:
- All
- Movies
TorrentMeta:
description: Torrent meta data object
type: object
required:
- name
- lenth
- progress
- speed
- downloaded
- eta
- completed
- peers
- ratio
- files
properties:
name:
description: The torrent file name
type: string
length:
description: The total length in bytes
type: number
comment:
description: The torrent file comment
type: string
progress:
description: The download progress, between 0.0 and 1.0
type: number
format: float
speed:
description: The download speed in bytes/second
type: number
format: float
downloaded:
description: The downloaded bytes
type: number
eta:
description: ETA in seconds
type: number
completed:
description: Is download completed
type: boolean
peers:
description: Number of connected peers
type: number
ratio:
description: The client's share ratio, Uploads/Downloads. Higher is better.
type: number
format: float
created:
description: The date of torrent file creation
type: number
format: int64
createdBy:
description: The creator name
type: string
files:
description: A list of content file for this torrent.
type: array
items:
$ref: '#/components/schemas/TorrentFile'
examples:
- $ref: '#/components/examples/TorrentMeta'
TorrentFile:
type: object
description: A torrent content file
required: [index, name, length, path, progress, downloaded]
properties:
index:
type: number
description: The file index or ID
name:
type: string
description: The file name
length:
type: number
description: File size in bytes
path:
type: string
description: The file path
progress:
type: number
format: float
description: The download progress, from 0.0 to 1.0
downloaded:
type: number
description: Downloaded bytes
examples:
- $ref: '#/components/examples/TorrentFile'
TorrentResult:
type: object
description: A torrent provider search result.
required: [title, size, magnet, provider]
properties:
title:
type: string
description: The torrent file title
time:
type: string
description: Torrent creation time
size:
type: string
description: Total torrent size
magnet:
type: string
description: The magnet uri of the torrent file.
description:
type: string
description: The torrent file description
provider:
type: string
description: The provider name
seeds:
type: number
description: number of seeders
peers:
type: number
description: number of leechers
link:
type: string
description: The link of the torrent on the provider site
Subtitle:
type: object
required: [id, type, language, downloads, trusted, ai_translated, machine_translated, url, details]
externalDocs:
description: OpenSubtitles API
url: "https://opensubtitles.stoplight.io/docs/opensubtitles-api"
properties:
id:
type: string
description: The subtitle id
type:
type: string
description: The subtitle type
language:
type: string
description: The subtitle language
downloads:
type: number
description: Total number of downloads
hd:
type: boolean
fps:
type: number
format: float
description: Number of frames per second
ratings:
type: number
format: float
votes:
type: number
description: number of votes
points:
type: number
format: float
description: the subtitle's score
trusted:
type: boolean
description: Is this subtitle from trusted uploader
ai_translated:
type: boolean
description: Is generated by AI
machine_translated:
type: boolean
description: Is translated
url:
type: string
description: the OpenSubtitle page
details:
type: object
description: More details about the subtitle
required: [id, type, title, name, imdb_id, tmdb_id, year, season, parent_title]
properties:
id:
type: string
descriptions: Feature's ID
type:
type: string
enum: [Movie, Episode]
description: The feature type
year:
type: number
description: The production year
title:
type: string
name:
type: string
imdb_id:
type: string
tmdb_id:
type: string
season:
type: number
episode:
type: number
parent_imdb_id:
type: number
parent_title:
type: string
uploader:
type: object
description: Uploader Information
properties:
id:
type: string
name:
type: string
rank:
type: string
SubtitleSearchResult:
type: object
description: Search subtitle result object
required: [pages, page, limit, count]
externalDocs:
description: OpenSubtitles API
url: "https://opensubtitles.stoplight.io/docs/opensubtitles-api"
properties:
pages:
type: number
description: Total pages count
page:
type: number
description: The current represented page
limit:
type: number
description: Maximum number of subtitles per page
count:
type: number
description: Total number of match subtitles
data:
type: array
items:
$ref: '#/components/schemas/Subtitle'
description: A list of matched subtitle objects
Error:
type: object
description: The general error form.
required: [status, statusCode, message]
properties:
code:
type: number
description: An error code/id.
error:
type: string
description: The error message.
paths:
/ping:
get:
summary: Check Server State
description: Check if server is running
responses:
200:
description: OK
content:
text/plain:
schema:
type: string
example:
pong
/search:
get:
summary: Get all supported providers.
description: |
Get a list with all supported providers and the categories for each.
tags: [Search]
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/SearchProvider'
example:
- ...
- name: Yts
categories: ['All', 'Movies']
- ...
/search/{provider}:
get:
summary: Get providers list
description: Use torrent provider to search for torrent files.
tags: [Search]
parameters:
- in: path
name: provider
required: true
schema:
type: string
examples:
YTS:
summary: YTS
value: Yts
P1337x:
summary: 1337x
value: 1337x
EZTV:
summary: Eztv
value: Eztv
KT:
summary: KickassTorrents
value: KickassTorrents
RBG:
summary: Rarbg
value: Rarbg
TPB:
summary: ThePirateBay
value: ThePirateBay
- in: query
name: q
description: |
The search query.
Use the endpoint `/search` to get a list of providers and the supported categories for each
required: true
schema:
type: string
example:
spider
- in: query
name: c
description: |
The category to filter on.
Use the endpoint `/search` to get a list of the supported categories for each provider.
schema:
type: string
example:
Movies
- in: query
name: l
description: The maximum number of results to return.
schema:
type: number
minimum: 1
example:
1
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/TorrentResult'
examples:
Default:
$ref: '#/components/examples/TorrentResult'
400:
description: Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
code: 4
error: query is required!
/torrent:
get:
tags: [Torrent]
summary: Get torrent meta info
parameters:
- $ref: '#/components/parameters/TorrentId'
responses:
200:
$ref: '#/components/responses/TorrentMeta'
400:
$ref: '#/components/responses/TorrentMetaError'
/torrent/meta/{hash}:
get:
tags: [Torrent]
summary: Get torrent meta info by hash
parameters:
- $ref: '#/components/parameters/TorrentInfoHash'
responses:
200:
$ref: '#/components/responses/TorrentMeta'
400:
$ref: '#/components/responses/TorrentMetaError'
/torrent/serve:
get:
tags: [Torrent]
summary: Serve file
description: Use **q** or **i** to select select a single file, if many files were selected the first one will be selected.
parameters:
- $ref: '#/components/parameters/TorrentId'
- $ref: '#/components/parameters/PickFileQuery'
- $ref: '#/components/parameters/PickFileIndex'
responses:
200:
$ref: '#/components/responses/FileServeOK'
400:
$ref: '#/components/responses/FileServeError'
404:
$ref: '#/components/responses/FileServeNotFoundError'
head:
tags: [Torrent]
summary: Check headers before download
description: Use **q** or **i** to select select a single file, if many files were selected the first one will be selected.
parameters:
- $ref: '#/components/parameters/TorrentId'
- $ref: '#/components/parameters/PickFileQuery'
- $ref: '#/components/parameters/PickFileIndex'
responses:
200:
description: OK
400:
$ref: '#/components/responses/FileServeError'
404:
$ref: '#/components/responses/FileServeNotFoundError'
/torrent/serve/{hash}:
get:
summary: Serve file using infoHash
description: Use **q** or **i** to select select a single file, if many files were selected the first one will be selected.
tags: [Torrent]
parameters:
- $ref: '#/components/parameters/TorrentInfoHash'
- $ref: '#/components/parameters/PickFileQuery'
- $ref: '#/components/parameters/PickFileIndex'
responses:
200:
$ref: '#/components/responses/FileServeOK'
400:
$ref: '#/components/responses/FileServeError'
404:
$ref: '#/components/responses/FileServeNotFoundError'
head:
summary: Check headers before download
description: Use **q** or **i** to select select a single file, if many files were selected the first one will be selected.
tags: [Torrent]
parameters:
- $ref: '#/components/parameters/TorrentInfoHash'
- $ref: '#/components/parameters/PickFileQuery'
- $ref: '#/components/parameters/PickFileIndex'
responses:
200:
description: OK
400:
$ref: '#/components/responses/FileServeError'
404:
$ref: '#/components/responses/FileServeNotFoundError'
/torrent/live/{hash}/*:
get:
summary: Live serve torrent file
tags: [Torrent]
parameters:
- $ref: '#/components/parameters/TorrentInfoHash'
responses:
200:
$ref: '#/components/responses/FileServeOK'
404:
$ref: '#/components/responses/FileServeNotFoundError'
head:
summary: Check headers before serve
tags: [Torrent]
parameters:
- $ref: '#/components/parameters/TorrentInfoHash'
responses:
200:
description: OK
404:
$ref: '#/components/responses/FileServeNotFoundError'
/torrent/live/{hash}/Sintel/poster.jpg:
get:
summary: Serve image file
description: Try to serve the image from `/torrent/serve/{hash}/*`
tags: [Torrent]
parameters:
- $ref: '#/components/parameters/TorrentInfoHash'
responses:
200:
$ref: '#/components/responses/FileServeOK'
404:
$ref: '#/components/responses/FileServeNotFoundError'
/subtitles:
get:
summary: Search for subtitles
description: |
Use OpenSubtitles as a provider to search for subtitles.
Supports pagination.
tags: [Subtitles]
parameters:
- in: query
name: query
description: A query to search for. It could be a movie, tv show or series name
schema:
type: string
examples:
Shazam:
summary: Shazam Movie
value: Shazam
FamilyGuy:
summary: Family Guy
value: family guy
- in: query
name: q
description: An alias for query
schema:
type: string
- in: query
name: imdb
description: Find subtitles by IMDB_ID
schema:
type: string
examples:
Shazam:
summary: Shazam
value: tt0448115
FamilyGuy:
summary: Family Guy
value: tt0182576
- in: query
name: tmdb
description: Find subtitles by TMDB_ID
schema:
type: string
- in: query
name: season
description: Find subtitles for a season
schema:
type: number
- in: query
name: episode
description: Find subtitles for an episode
schema:
type: number
- in: query
name: page
description: The page number
schema:
type: number
minimum: 1
example: 1
- in: query
name: year
description: Filter by movie/episode year
schema:
type: number
- in: query
name: type
description: Filter by type
schema:
type: string
enum: [movie, series, all]
example: all
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/SubtitleSearchResult'
examples:
Default:
$ref: '#/components/examples/SubtitleSearchResult'
500:
description: Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'