[
  {
    "path": ".gitattributes",
    "content": "# Auto detect text files and perform LF normalization\n* text=auto\n"
  },
  {
    "path": ".gitignore",
    "content": "*.db\n*.py[cod]\n.env\n.web\n__pycache__/\nassets/external/\n"
  },
  {
    "path": "README.md",
    "content": "# Movie Streaming Site\n\nA site built in [Reflex](https://reflex.dev) that uses the [MoviesAPI.club](https://moviesapi.club) and the [TMDB](https://www.themoviedb.org/) api for movies streaming of thousands of movies for 100% free.\n\nSearch, streaming, recomended and getting info about movies are all features of the site that can be had for free and with barely any loading times.\n\n\n\n### Self hosting:\nTo self host and for developmentyou need python 3.11 or above[^1] \nin terminal, navigate to the `movie_streaming_site` folder and run \n\n`python -m pip install -r /requirements.txt`\n\nOnce done, create a file called `.env` and using notepad write\n\n`\nauth=\"{YOUR TMDBAPI KEY HERE}\"\n`\n\nand replace `{YOUR TMDBAPI KEY HERE}` with an api key from [TMDB api](https://developer.themoviedb.org/v4/reference/intro/getting-started)\n\nto run just write `python -m reflex run` in the command line\n\n\n\n[^1]:version 3.11 or above is fine, older versions may work but I haven't tested them\n\n### Demo / screenshots:\nhttps://github.com/user-attachments/assets/35242525-660c-4737-be4e-bd7110d54232\n\n\n![image](https://github.com/user-attachments/assets/05263ca7-04e4-45f3-bd30-5e163a2a1bfb)\n![image](https://github.com/user-attachments/assets/ce6551bf-5ba1-43e3-a64d-2e56085c8bf1)\n\n##### The site was built for [Hack Club Arcade](https://hackclub.com/arcade/)\n"
  },
  {
    "path": "movie_streaming_site/__init__.py",
    "content": ""
  },
  {
    "path": "movie_streaming_site/components/keybind.py",
    "content": "import reflex as rx\n\n\nclass GlobalKeyWatcher(rx.Fragment):\n    # List of keys to trigger on\n    keys: rx.Var[list[str]] = []\n\n    # The event handler that will be called\n    bind: rx.EventHandler[lambda ev: [ev.key]]\n\n    def _get_imports(self) -> rx.utils.imports.ImportDict:\n        return rx.utils.imports.merge_imports(\n            super()._get_imports(),\n            {\n                \"react\": {\n                    rx.utils.imports.ImportVar(\n                        tag=\"useEffect\"\n                    )\n                }\n            },\n        )\n\n    def _get_hooks(self) -> str | None:\n        return \"\"\"\n            useEffect(() => {\n                const handle_key = (_ev) => {\n                    if (%s.includes(_ev.key))\n                        %s\n                }\n                document.addEventListener(\"keydown\", handle_key, false);\n                return () => {\n                    document.removeEventListener(\"keydown\", handle_key, false);\n                }\n            })\n            \"\"\" % (\n            self.keys,\n            rx.utils.format.format_event_chain(\n                self.event_triggers[\"bind\"]\n            ),\n        )\n\n    def render(self):\n        return \"\"  # No visual element, hooks only\nKeybind = GlobalKeyWatcher.create"
  },
  {
    "path": "movie_streaming_site/components/loading.py",
    "content": "import reflex as rx\nfrom reflex_lottiefiles import LottieFiles\n\ndef loading():\n    rx.center(\n        rx.vstack(\n            rx.center(\n                rx.heading(\"Loading, please wait\"),\n                width=\"90vw\",\n            ),\n            LottieFiles(\n                src=\"https://lottie.host/5ff06a80-3f45-4dd3-8737-f4cf62ba3d48/X5hdVEjbNK.lottie\",\n                autoplay=True,\n                loop=True,\n                width=\"90vw\",\n                height=[\"40vh\", \"40vh\", \"40vh\"],\n            )\n        ),\n        \n        width=\"90vw\",\n        height=\"80vh\"\n        \n    ),\n\n\n"
  },
  {
    "path": "movie_streaming_site/components/moviecard.py",
    "content": "import reflex as rx\nfrom reflex_motion import motion\n\n\ndef movie_card(title: str, year: str, duration: str, link:str, img:str = \"https://via.placeholder.com/316x421\", description:str = \"\"):\n    return rx.hover_card.root(\n        rx.hover_card.trigger(\n            rx.link(\n                \n                motion(\n                    rx.image(\n                        src=img,\n                        width=\"100%\",\n                        height=\"47vh\",\n                        object_fit=\"contain\"\n                    ),\n                    rx.vstack(\n                        rx.hstack(\n                            rx.text(year, color=\"#C0C0C0\", font_size=\"2vh\", font_style=\"italic\"),\n                            rx.text(duration, color=\"#C0C0C0\", font_size=\"2vh\", font_style=\"italic\", text_align=\"right\", width=\"100%\"),\n                            width=\"100%\"\n                        ),\n                        rx.heading(title, color=\"#F2F2F2\", font_size=\"4vh\", font_weight=\"800\"),\n                        spacing=\"0.5vh\",\n                        align_items=\"flex-start\",\n                        padding=\"1.7vh\",\n                    ),\n                    padding=\"1vw\",\n                    width=\"100%\",\n                    #height=\"60.4vh\",\n                    bg=\"#1A1A1A\",\n                    border_radius=\"1vh\",\n                    #border=\"0.1vh solid #D9D9D9\",\n                    while_hover={\"scale\": 1.02},\n                    while_tap={\"scale\": 0.98},\n                    transition={\"type\": \"spring\", \"stiffness\": 400, \"damping\": 17},\n                ),\n                padding=\"1vw\",\n                width=\"100%\",\n                border_radius=\"1vh\",\n                href=link,\n                is_external=True\n            )\n            \n        ),\n        rx.hover_card.content(\n            rx.hstack(\n                rx.vstack(\n                    rx.heading(\n                        title,\n                        width=\"30vh\"\n                    ),\n                    rx.image(\n                        src=img,\n                        width=\"30vh\"\n                    ),\n                    width=\"90vh\"\n                ),\n                rx.text(\n                    description\n                )\n            ),\n            side=\"right\"\n        ),\n        open_delay=900\n        \n    )\n\n    "
  },
  {
    "path": "movie_streaming_site/components/search.py",
    "content": "import reflex as rx\nfrom movie_streaming_site.state import State\nfrom reflex_motion import motion\nfrom movie_streaming_site.components.keybind import Keybind\n\ndef search():\n    return rx.hstack(\n        Keybind(\n            keys=[\"Enter\"],\n            bind=State.go_search\n        ),\n        motion(\n            rx.button(\n                rx.icon(tag=\"search\", color=\"white\", size=30),\n                variant=\"ghost\",\n                on_click=lambda: State.go_search(\"A\")\n            ),\n            while_hover={\"scale\": 1.05},\n            transition={\"type\": \"spring\", \"stiffness\": 400, \"damping\": 17},\n        ),\n        motion(\n            rx.input(\n                placeholder=\"Search\",\n                color=\"white\",\n                font_size=\"3.5vh\",\n                width=\"100%\",\n                background_color=\"rgba(255, 255, 255, 0)\",\n                border=\"none\",\n                border_width=\"0px\",\n                height=\"30\",\n                value=State.search_value,\n                on_change=State.change_search_value\n            ),\n            width=\"100%\",\n            while_hover={\"scale\": 1.02},\n            transition={\"type\": \"spring\", \"stiffness\": 400, \"damping\": 17},\n        ),\n        on_focus= State.search_focus,\n        on_blur=State.search_blur,\n        bg=\"rgba(0, 0, 0, 0.29)\",\n        border_radius=\"1087vh\",\n        padding=\"0.5vh\",\n        width=[\"90vw\", \"90vw\", \"48vw\"],\n        position=\"absolute\",\n        left=[\"5vw\",\"5vw\", \"28vw\"],\n        top=\"2vh\",\n    ),"
  },
  {
    "path": "movie_streaming_site/movie_streaming_site.py",
    "content": "import reflex as rx\nfrom movie_streaming_site.components.moviecard import movie_card\nfrom movie_streaming_site.state import State\nfrom movie_streaming_site.components.search import search\nfrom reflex_lottiefiles import LottieFiles\nfrom movie_streaming_site.components.loading import loading\nfrom movie_streaming_site.pages.player import movieplayer\nfrom movie_streaming_site.pages.search import search_page\nfrom reflex_motion import motion\n\n\nclass slider(rx.Component):\n    library = \"nuka-carousel\"\n    tag = \"Carousel\"\n    autoplay:rx.Var[bool]\n    showDots:rx.Var[bool]\n    wrapMode:rx.Var[str]\n    autoplayInterval:rx.Var[int]\n    scrollDistance:rx.Var[str]\n\n\n\n@rx.page(on_load=State.on_load)\ndef index():\n    return rx.box(\n        \n        rx.box(\n            Slider(\n                rx.image(src=\"https://media.themoviedb.org/t/p/w1920_and_h800_multi_faces/qGQf2OHIkoh89K8XeKQzhxczf96.jpg\", width=\"110vw\", height=\"108vh\", object_fit = \"cover\"),\n                rx.image(src=\"https://media.themoviedb.org/t/p/w1920_and_h800_multi_faces/stKGOm8UyhuLPR9sZLjs5AkmncA.jpg\", width=\"110vw\", height=\"108vh\", object_fit = \"cover\"),\n                rx.image(src=\"https://media.themoviedb.org/t/p/w1920_and_h800_multi_faces/eHz61dRrYZB16glXDttV0CnJf6j.jpg\", width=\"110vw\", height=\"108vh\", object_fit = \"cover\"),\n                rx.image(src=\"https://media.themoviedb.org/t/p/w1920_and_h800_multi_faces/mabuNsGJgRuCTuGqjFkWe1xdu19.jpg\", width=\"110vw\", height=\"108vh\", object_fit = \"cover\"),\n                autoplay=True,\n                showDots=False,\n                autoplayInterval=6000,\n                scrollDistance=\"slide\",\n                wrapMode=\"wrap\",\n                overflow=\"hidden\"\n            ),\n            \n            \n            rx.box(\n                width=\"100vw\",\n                height=\"108vh\",\n                position=\"absolute\",\n                left=\"0\",\n                top=\"0\",\n                bg=\"linear-gradient(180deg,rgba(18, 18, 18, 0.25) 0%, rgba(18, 18, 18, 0.77) 50%, rgba(18, 18, 18, 0.90) 77%, #121212 93%)\",\n                overflow=\"hidden\"\n            ),\n            motion(\n                \n                position=\"absolute\",\n                left=\"7vw\",\n                top=\"70vh\",\n                width=\"24vw\",\n                height=\"16vh\",\n                while_hover={\"scale\": 1.2},\n                while_tap={\"scale\": 0.9},\n                transition={\"type\": \"spring\", \"stiffness\": 400, \"damping\": 17},\n            ),\n            rx.heading(\n                \"OPENSTREAM\",\n                font_size=\"15vw\",\n                font_weight=\"bolder\",\n                text_wrap = \"nowrap\",\n                letter_spacing = \"-4px\",\n                color=\"white\",\n                position=\"absolute\",\n                left=\"2.5vw\",\n                top=\"20vh\",\n                width=\"85vw\",\n                height=\"30vh\",\n                line_height=\"10vw\",\n                display = [\"block\", \"none\", \"none\"]\n            ),\n            rx.heading(\n                \"Thousands of\",\n                font_size=[\"10vw\", \"12vw\", \"14vh\"],\n                font_weight=\"1000\",\n                text_wrap = \"nowrap\",\n                color=\"white\",\n                position=\"absolute\",\n                left=\"7vw\",\n                top=[\"30vh\",\"20vh\", \"20vh\"],\n                width=[\"85vw\", \"50vw\",\"50vw\"],\n                height=\"30vh\",\n                line_height=[\"10vw\", \"10vw\", \"14vh\"],\n            ),\n            rx.heading(\n                \"movies, right at\",\n                font_size=[\"10vw\", \"12vw\", \"14vh\"],\n                font_weight=\"1000\",\n                text_wrap = \"nowrap\",\n                color=\"white\",\n                position=\"absolute\",\n                left=\"7vw\",\n                top=[\"39vh\", \"30vh\", \"34vh\"],\n                width=[\"85vw\", \"50vw\",\"50vw\"],\n                height=\"30vh\",\n                line_height=[\"10vw\", \"10vw\", \"14vh\"],\n            ),\n            rx.heading(\n                \"your fingertips\",\n                font_size=[\"10vw\", \"12vw\", \"14vh\"],\n                font_weight=\"1000\",\n                text_wrap = \"nowrap\",\n                color=\"white\",\n                position=\"absolute\",\n                left=\"7vw\",\n                top=[\"48vh\", \"40vh\", \"48vh\"],\n                width=[\"85vw\", \"50vw\",\"50vw\"],\n                height=\"30vh\",\n                line_height=[\"10vw\", \"10vw\", \"14vh\"],\n            ),\n            search(),\n            width=\"100vw\",\n            height=\"111vh\",\n            position=\"relative\",\n            overflow=\"hidden\"\n        ),\n        \n        rx.center(\n            rx.cond(\n                State.loading,\n                rx.center(\n                    rx.vstack(\n                        rx.center(\n                            rx.heading(\"Loading, please wait\"),\n                            width=\"90vw\",\n                        ),\n                        LottieFiles(\n                            src=\"https://lottie.host/5ff06a80-3f45-4dd3-8737-f4cf62ba3d48/X5hdVEjbNK.lottie\",\n                            autoplay=True,\n                            loop=True,\n                            width=\"90vw\",\n                            height=[\"40vh\", \"40vh\", \"40vh\"],\n                        )\n                    ),\n                    \n                    width=\"90vw\",\n                    height=\"80vh\"\n                    \n                ),\n            ),\n            rx.desktop_only(\n                rx.grid(\n                    \n                    rx.foreach(\n                        State.now_playing,\n                        lambda info, index: movie_card(info[\"title\"], info[\"year\"], f\"{info['runtime']} mins\", info[\"link\"], info[\"poster\"], description=info[\"description\"])\n                        \n                    ),\n                    spacing=\"1.5vh\",\n                    columns=\"4\",\n                    position=\"absolute\",\n                    left=\"1.5vw\",\n                    top=\"105vh\",\n                    width=\"100%\",\n                    overflow=\"hidden\"\n                    \n                ),\n            ),\n            rx.mobile_and_tablet(\n                rx.grid(\n                    \n                    rx.foreach(\n                        State.now_playing,\n                        lambda info, index: movie_card(info[\"title\"], info[\"year\"], f\"{info['runtime']} mins\", info[\"link\"], info[\"poster\"], description=info[\"description\"])\n                        \n                    ),\n                    spacing=\"1.5vh\",\n                    columns=\"1\",\n                    position=\"absolute\",\n                    left=\"1.5vw\",\n                    top=\"105vh\",\n                    width=\"100%\",\n                    overflow=\"hidden\"\n                    \n                ),\n            ),\n            \n            width=\"100%\",\n            overflow=\"hidden\"\n        ),\n        \n        bg=\"#121212\",\n        position=\"relative\",\n        overflow_x=\"hidden\",\n    )\n\n\n\n\n\n\n\nSlider = slider.create\n\ndef testpage():\n    return rx.box(\n        Slider(\n            rx.image(src=\"https://commerce.nearform.com/open-source/nuka-carousel/img/pexels-01.jpg\"),\n            rx.image(src=\"https://commerce.nearform.com/open-source/nuka-carousel/img/pexels-02.jpg\"),\n            rx.image(src=\"https://commerce.nearform.com/open-source/nuka-carousel/img/pexels-03.jpg\"),\n            rx.image(src=\"https://commerce.nearform.com/open-source/nuka-carousel/img/pexels-04.jpg\"),\n            autoplay=True,\n            showDots=True,\n            autoplayInterval=3000,\n            wrapMode=\"wrap\",\n        )\n    )\n\n\n\nstyle = {\n    \"body\":{\n        \"background-color\":\"#121212\",\n        \"overflow\":\"hidden\"\n    },\n    \"html\":{\n        \"overflow\":\"hidden\"\n    }\n}\n\napp = rx.App(style = style)\napp.add_page(search_page)\napp.add_page(movieplayer)\napp.add_page(index)\napp.add_page(testpage)"
  },
  {
    "path": "movie_streaming_site/pages/player.py",
    "content": "import reflex as rx\nfrom reflex_lottiefiles import LottieFiles\nfrom movie_streaming_site.state import State \nfrom movie_streaming_site.components.search import search\n\n\n@rx.page(route=\"/movieplayer/[movieid]\", on_load=State.on_load)\ndef movieplayer():\n    return rx.box(\n        search(),\n        \n        rx.cond(\n            State.loading,\n            rx.center(\n                rx.vstack(\n                    rx.center(\n                        rx.heading(\"Loading, please wait\"),\n                        width=\"90vw\",\n                    ),\n                    LottieFiles(\n                        src=\"https://lottie.host/5ff06a80-3f45-4dd3-8737-f4cf62ba3d48/X5hdVEjbNK.lottie\",\n                        autoplay=True,\n                        loop=True,\n                        width=\"90vw\",\n                        height=[\"40vh\", \"40vh\", \"40vh\"],\n                    )\n                ),\n                \n                width=\"90vw\",\n                height=\"80vh\"\n                \n            ),\n\n            \n            rx.box(\n                rx.text(State.current_movie[\"title\"], font_size=\"10.5vh\", font_weight=\"800\"),\n                rx.hstack(\n                    rx.desktop_only(\n                        rx.html(\n                            State.movie_iframe,\n                            width=\"50vw\"\n                        ),\n                    ),\n                    rx.mobile_and_tablet(\n                        rx.html(\n                            State.movie_iframe,\n                            width=\"85vw\"\n                        ),\n                    ),\n                    #rx.box(width=\"960px\", height=\"540px\", bg=\"#D9D9D9\"),\n                    rx.desktop_only(\n                        rx.vstack(\n                            rx.text(\n                                \"Description\",\n                                color=\"white\",\n                                font_size=\"4vh\",\n                                font_weight=\"800\"\n                            ),\n                            rx.text(\n                                State.current_movie[\"description\"],\n                                color=\"white\",\n                                font_size=\"3vh\",\n                                max_width=\"28vw\"\n                            ),\n                            align_items=\"flex-start\",\n                        ),\n                    ),\n                    rx.desktop_only(\n                        rx.vstack(\n                            movie_info_item(State.current_movie[\"date\"], \"calendar\"),\n                            movie_info_item(State.current_movie[\"revenue\"], \"dollar-sign\"),\n                            movie_info_item(State.current_movie[\"runtime\"], \"clock\"),\n                            \n                            rx.cond(\n                                State.current_movie[\"site\"],\n                                rx.link(\n                                    movie_info_item(\"Site\", \"globe\"),\n                                    href=State.current_movie[\"site\"],\n                                    is_external=True\n                                ),\n                            ),\n                            rx.cond(\n                                State.current_movie[\"tmdb_link\"],\n                                rx.link(\n                                    movie_info_item(\"TMDB\", \"clock\"),\n                                    href=State.current_movie[\"tmdb_link\"],\n                                    is_external=True\n                                ),\n                            ),\n                            rx.cond(\n                                State.current_movie[\"imdb_link\"],\n                                rx.link(\n                                    movie_info_item(\"IMDB\", \"clock\"),\n                                    href=State.current_movie[\"imdb_link\"],\n                                    is_external=True\n                                )\n                            )\n                            \n                            \n                            \n                        ),\n                    ),\n                    spacing=\"2vw\",\n                ),\n            )\n        ),\n        \n       \n       \n        width = \"100%\",\n        padding=\"5.5vh\",\n    )\n\ndef movie_info_item(text, icon):\n    return rx.hstack(\n        rx.center(\n            rx.icon(\n                icon,\n            ),\n           \n        ),\n        rx.center(\n            rx.text(text, color=\"white\", font_size=\"2.5vh\"),\n        ),\n       \n        spacing=\"1vw\",\n    )\n"
  },
  {
    "path": "movie_streaming_site/pages/search.py",
    "content": "import reflex as rx\nfrom movie_streaming_site.state import State\nfrom movie_streaming_site.components.search import search\nfrom movie_streaming_site.components.moviecard import movie_card\n@rx.page(route=\"/search/[query]\", on_load=State.search_on_load)\ndef search_page():\n    return rx.box(\n        search(),\n        rx.text(\n            State.search_query,\n            font_size=\"10.5vh\",\n            font_weight=\"800\",\n            padding_top=\"5vh\"\n        ),\n        rx.desktop_only(\n            rx.grid(\n                \n                rx.foreach(\n                    State.search_results,\n                    lambda info, index: movie_card(info[\"title\"], info[\"year\"], \"\", info[\"link\"], info[\"poster\"], description=info[\"description\"])\n                ),\n                spacing=\"1.5vh\",\n                columns=\"4\",\n                width=\"100%\"\n            ),\n        ),\n        rx.mobile_and_tablet(\n            rx.grid(\n                \n                rx.foreach(\n                    State.search_results,\n                    lambda info, index: movie_card(info[\"title\"], info[\"year\"], \"\", info[\"link\"], info[\"poster\"], description=info[\"description\"])\n                ),\n                spacing=\"1.5vh\",\n                columns=\"1\",\n                width=\"100%\"\n            ),\n        )\n    )\n        "
  },
  {
    "path": "movie_streaming_site/state.py",
    "content": "import reflex as rx\nimport requests\nimport dotenv\nimport os\nimport json\ndotenv.load_dotenv()\nauth = os.environ.get(\"auth\")\nclass State(rx.State):\n    now_playing:list[dict[str, str]]\n    movie_iframe:str\n    current_movie:dict[str, str]\n    loading:bool = True\n    search_results:list[dict[str, str]]\n    search_focused:bool = False\n    search_value:str\n    def change_search_value(self, new):\n        self.search_value = new\n        \n    @rx.var\n    def search_url(self) -> str:\n        return f\"/search/{self.search_value}/\"\n    \n    def search_focus(self):\n        self.search_focused = True\n    def search_blur(self):\n        self.search_focused = False\n    \n    def go_search(self, _):\n        if self.search_value and self.search_focused:\n            return rx.redirect(f\"/search/{self.search_value}/\")\n    \n    \n    @rx.var\n    def search_query(self) -> str:\n        \n        return self.router.page.params.get(\"query\", \"\")\n    @rx.var\n    def movie_id(self) -> str:\n        \n        return self.router.page.params.get(\"movieid\", \"\")\n    \n    def search(self, query):\n        url = f\"https://api.themoviedb.org/3/search/movie?query={query}\"\n        headers = {\n            \"accept\": \"application/json\",\n            \"Authorization\": f\"Bearer {os.environ.get('auth')}\"\n        }\n\n        response = requests.get(url, headers=headers)\n        data = json.loads(response.text)\n        print(data)\n        results = data[\"results\"]\n        for result in results:\n            result.pop(\"adult\")\n            result.pop(\"genre_ids\")\n            result[\"id\"] = str(result[\"id\"])\n            result.pop(\"original_language\")\n            result.pop(\"original_title\")\n            result.pop(\"popularity\")\n            result[\"year\"] = result[\"release_date\"][:4]\n            result.pop(\"release_date\")\n            result.pop(\"video\")\n            result.pop(\"vote_average\")\n            result.pop(\"vote_count\")\n            result[\"link\"] = f\"/movieplayer/{result['id']}\"\n            result[\"description\"] = result[\"overview\"]\n            result[\"poster\"] = f\"https://image.tmdb.org/t/p/w300_and_h450_bestv2/{result['poster_path']}\"\n        print(results)\n        return results\n    \n    \n    def search_on_load(self):\n        print(f\"Searched for {self.search_query}\")\n        self.search_results = self.search(self.search_query)\n    \n    \n    \n    def get_current_movie(self):\n        movie_id = self.movie_id\n        data = self.get_movie_data(movie_id)\n        print(data)\n        try:\n            result = {\n                \n                \n                \"imdb_link\":f\"https://www.imdb.com/title/{data['imdb_id']}/\",\n                \"tmdb_link\":f\"https://www.themoviedb.org/movie/{data['id']}\",\n                \"description\":data[\"overview\"],\n                \"runtime\":f\"{data['runtime']} min\",\n                \"revenue\":f\"${data['revenue']}\",\n                \"title\":data[\"title\"],\n                \"date\":data[\"release_date\"]\n            }\n        except:\n            return\n        try:\n            result[\"site\"]= data[\"homepage\"]\n        except:\n            pass\n        return result\n        \n    \n    \n    \n    def get_movie_data(self, id):\n        url = f\"https://api.themoviedb.org/3/movie/{id}?language=en-US\"\n        response = requests.get(\n            url,\n            headers={\n                \"accept\": \"application/json\",\n                \"Authorization\": f\"Bearer {auth}\"\n            }\n        )\n        data = json.loads(response.text)\n        return data\n    \n    def get_now_playing_movies(self):\n        url = \"https://api.themoviedb.org/3/movie/now_playing?language=en-US&page=1\"\n        response = requests.get(\n            url,\n            headers={\n                \"accept\": \"application/json\",\n                \"Authorization\": f\"Bearer {auth}\"\n            }\n        )\n        \n        data = json.loads(response.text)\n        results = data[\"results\"]\n        \n        \n        result_list = []\n        for result in results:\n            result_list.append(\n                {\n                    \"poster\":f\"https://image.tmdb.org/t/p/w300_and_h450_bestv2/{result['poster_path']}\",\n                    \"title\": result[\"title\"],\n                    \"year\":result[\"release_date\"][:4],\n                    \"description\":result[\"overview\"],\n                    \"runtime\":self.get_movie_data(result[\"id\"])[\"runtime\"],\n                    \"link\":f\"/movieplayer/{result['id']}\"\n                }\n            )\n        return result_list\n    def on_load(self):\n        self.loading = True\n        print(\"start load\")\n        self.movie_iframe = f' <iframe src=\"https://moviesapi.club/movie/' + self.router.page.params.get(\"movieid\", \"123456\") + '\" frameborder=\"0\" allowFullScreen=\"true\" webkitallowfullscreen=\"true\" mozallowfullscreen=\"true\" style=\"height:60vh; width:100%\"></iframe>'\n        print(\"load iframe\")\n        self.now_playing = self.get_now_playing_movies()\n        print(\"load now playing\")\n        self.current_movie = self.get_current_movie()\n        print(\"load current\")\n        self.loading=False\n        return rx.toast(\"This website is for educational purposes only, I am not distrubuiting these movies, this is just a wrapper for https://moviesapi.club\", duration=5000)\n    \n    "
  },
  {
    "path": "requirements.txt",
    "content": "python-dotenv==1.0.1\nreflex-lottiefiles==0.0.2\nreflex-motion==0.0.1\nreflex==0.5.9"
  },
  {
    "path": "rxconfig.py",
    "content": "import reflex as rx\n\nconfig = rx.Config(\n    app_name=\"movie_streaming_site\",\n    frontend_port=60769,\n    backend_port=40167,\n    api_url=\"https://openstreamapi.thegrass.xyz\"\n)\n"
  }
]