From ac3057fd52d9a0141231d47c9fc55501cb7896c1 Mon Sep 17 00:00:00 2001 From: fanyx Date: Fri, 21 May 2021 19:52:50 +0200 Subject: [PATCH] add match case to parse modules --- url.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 url.py diff --git a/url.py b/url.py new file mode 100644 index 0000000..5bb3d35 --- /dev/null +++ b/url.py @@ -0,0 +1,14 @@ +from urllib.parse import urlparse + +def parse_link(url): + u = urlparse(url) + match u.netloc: + case 'www.imdb.com' | 'imdb.com': + parse_imdb(u.path) + case 'myanimelist.net': + parse_mal(u.path) + case _: + url_not_supported(u) + +def parse_mal(path): + \ No newline at end of file