aboutsummaryrefslogtreecommitdiff
path: root/automedia.py
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-11-20 06:36:17 +0100
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:12:34 +0200
commitd72ec3c5a20e2302b991c7bd60d39f7177bf2ec9 (patch)
tree886f4a116dde9d493d37c8c859b79b13a073ce04 /automedia.py
parent472e0333c05207fef5cf13a0585a91fa78e233d9 (diff)
Remove dependency on tldextract
Diffstat (limited to 'automedia.py')
-rwxr-xr-xautomedia.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/automedia.py b/automedia.py
index 2585aab..9bd142d 100755
--- a/automedia.py
+++ b/automedia.py
@@ -7,10 +7,10 @@ import sys
import time
import json
import uuid
-# TODO: Remove this shit. It gives warning and it's slow
-import tldextract
import transmissionrpc
+from domain import url_extract_domain
+
from lxml import etree
from datetime import datetime
@@ -319,7 +319,10 @@ def add_rss(name, url, rss_config_dir, start_after):
return True
def add_html(name, url, html_config_dir, start_after):
- domain = tldextract.extract(url).domain
+ domain = url_extract_domain(url)
+ if len(domain) == 0:
+ print("Invalid url: {}".format(url))
+ return False
domain_plugin_path = os.path.join(script_dir, "plugins", domain)
domain_plugin_py_path = os.path.join(script_dir, "plugins", domain + ".py")