python showing this TypeError: string indices must be integers

Solution for python showing this TypeError: string indices must be integers
is Given Below:

I’m running this python Code in Kali Terminal and facing this problem.
I found this code in Github

This script download movies from torrent and it uses WebTorrent API
Once I used this script in windows it was working without any error but when I switch to kali linux and try to run this script I’m facing this error.

I’m not very much familiar with python

Here is my Code

import requests
import subprocess
import sys

def main():
    movie_name = input("Enter the movie name:n")
    print(f"Searching for {movie_name}")
    base_url = f"{movie_name}"
    torrent_results = requests.get(url=base_url).json()
    index = 1
    magnet = []
    for result in torrent_results:
        if 'movie' in result['type'].lower():
            print(index, ") ", result['name'], "-->", result['size'])
            index += 1
    if magnet:
        choice = int(
            input("Enter the index of the movie which you want to streamn"))
            magnet_link = magnet[choice-1]
            download = False  # Default is streaming
            stream_choice = int(
                input("Press 1 to stream or Press 2 to download the movien"))
            if stream_choice == 2:
                download = True

            webtorrent_stream(magnet_link, download)
        except IndexError:
            print("Incorrect Index entered")
        print(f"No results found for {movie_name}")

# Handle Streaming

def webtorrent_stream(magnet_link: str, download: bool):
    cmd = []
    if not download:

    if sys.platform.startswith('linux'):
    elif sys.platform.startswith('win32'):, shell=True)

if __name__ == "__main__":


Enter the movie name:
Baby Boss
Searching for Baby Boss
Traceback (most recent call last):
  File "/home/shiva/Desktop/TorrFlix/", line 61, in <module>
  File "/home/shiva/Desktop/TorrFlix/", line 23, in main
    if 'movie' in result['type'].lower():
TypeError: string indices must be integers

This API is down currently that’s why it is returning {'message': 'API is Down!', 'status': False} as response instead of expected movie data. Which is the cause of the error.