File tree 1 file changed +16
-3
lines changed
apps/graphql-api/src/shared/search/adapters
1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,6 @@ export class OneThreeThreeSevenXSearchAdapater extends SearchAdapter {
33
33
* Search for a episode
34
34
*
35
35
* @param episode
36
- * @param isRetry
37
36
* @returns {Promise<*> }
38
37
*/
39
38
searchEpisode = async ( episode : Episode ) => {
@@ -67,12 +66,26 @@ export class OneThreeThreeSevenXSearchAdapater extends SearchAdapter {
67
66
* Search for movies
68
67
*
69
68
* @param movie
70
- * @param isRetry
71
69
* @returns {Promise<*> }
72
70
*/
73
71
searchMovie = async ( movie : Movie ) => {
74
72
try {
75
- // TODO
73
+ const { torrents, domain } = await search ( {
74
+ query : movie . title ,
75
+ category : 'Movies'
76
+ } )
77
+
78
+ // Get all the torrents from trusted uploaders
79
+ const foundTorrents = torrents . filter ( ( torrent ) =>
80
+ this . trustedUploaders . includes ( torrent . uploader )
81
+ )
82
+
83
+ const results = await Promise . all (
84
+ foundTorrents . map ( ( torrent ) => this . formatTorrent ( torrent , domain ) )
85
+ )
86
+
87
+ return results . filter ( Boolean )
88
+
76
89
} catch ( e ) {
77
90
this . logger . error ( 'Error searching for movie!' , e )
78
91
}
You can’t perform that action at this time.
0 commit comments