1diff --git a/jnfilter/__init__.py b/jnfilter/__init__.py
2index 2c7641a07a789f2d4b170076174701443c1670e2..35be6bd4c97fbe3e44b81d07c076bb3662780ae4 100644
3--- a/jnfilter/__init__.py
4+++ b/jnfilter/__init__.py
5@@ -1,15 +1,13 @@
6 import re
7 import httpx
8-import uvicorn
9
10 from functools import reduce
11 from typing import List, Iterator, Union
12 from xml.etree.ElementTree import ElementTree, fromstring, tostring, register_namespace
13-from fastapi import FastAPI
14-from starlette.responses import Response, PlainTextResponse
15
16+from flask import Flask, Response, request
17
18-app = FastAPI()
19+app = Flask(__name__)
20
21 URL = "https://jovemnerd.com.br/feed-nerdcast/"
22
23@@ -32,9 +30,6 @@ register_namespace("googleplay", GOOGLEPLAY)
24 register_namespace("itunes", ITUNES)
25 register_namespace("atom", ATOM)
26
27-
28-class XMLResponse(Response):
29- media_type = "application/xml"
30
31
32 def match(title: str, series: List[str]) -> bool:
33@@ -74,36 +69,34 @@ for item in tree_root.findall("./channel/item"):
34 yield item.find("title").text
35
36
37-async def load_and_filter(series: str, tag: Union[bool, None] = False) -> str:
38+def load_and_filter(series: str, tag: Union[bool, None] = False) -> str:
39 series = series or 'nerdcast'
40 series = series.split(',')
41- async with httpx.AsyncClient() as client:
42- response = await client.get(URL)
43+ with httpx.Client() as client:
44+ response =client.get(URL)
45 xml_str = response.content
46 return filter_xml(xml_str, series, tag)
47
48
49-async def load_titles() -> Iterator[str]:
50- async with httpx.AsyncClient() as client:
51- response = await client.get(URL)
52+def load_titles() -> Iterator[str]:
53+ with httpx.Client() as client:
54+ response = client.get(URL)
55 xml_str = response.content
56 return filter_titles_xml(xml_str)
57
58-@app.head("/")
59-@app.get("/", response_class=XMLResponse)
60-async def root(q: str = '', tag: Union[bool, None] = False):
61- return await load_and_filter(q, tag)
62+@app.route("/", methods=['GET', 'HEAD'])
63+def root(q: str = '', tag: Union[bool, None] = False):
64+ q = request.args.get("q", "")
65+ tag = request.args.get("tag", False)
66+ return load_and_filter(q, tag), 200, {'Content-Type': 'application/xml'}
67
68
69-@app.get("/titles", response_class=PlainTextResponse)
70-async def titles():
71- titles = await load_titles()
72+@app.route("/titles", methods=['GET'])
73+def titles():
74+ titles = load_titles()
75 return "\n".join(titles)
76
77
78-@app.get("/series")
79-async def titles():
80+@app.route("/series", methods=['GET'])
81+def series():
82 return [i[0] for i in RegexCollection.items()]
83-
84-def run():
85- uvicorn.run(app=app, host="0.0.0.0", port=32000)
86diff --git a/setup.py b/setup.py
87index 07add8246257827906a2d7f0a149d2a00ff2223d..7692d27d74355ce026d0fc38d5e9febdd85f2026 100644
88--- a/setup.py
89+++ b/setup.py
90@@ -2,8 +2,7 @@ from setuptools import setup
91
92 requirements = [
93 'httpx==0.21.1',
94- 'fastapi==0.70.0',
95- 'uvicorn==0.15.0'
96+ 'flask==2.2.2',
97 ]
98
99