Skip to content

Commit e693d75

Browse files
authored
Remove call to favicongrabber.com (#328)
1 parent 42b6d42 commit e693d75

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

usr/lib/webapp-manager/common.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import configparser
55
import gettext
66
from io import BytesIO
7-
import json
87
import locale
98
import os
109
from random import choice
@@ -512,25 +511,7 @@ def download_favicon(url):
512511
(scheme, netloc, path, _, _, _) = urllib.parse.urlparse(url)
513512
root_url = "%s://%s" % (scheme, netloc)
514513

515-
# try favicon grabber first
516-
try:
517-
response = requests.get("https://favicongrabber.com/api/grab/%s?pretty=true" % netloc, timeout=3)
518-
if response.status_code == 200:
519-
source = response.content.decode("UTF-8")
520-
array = json.loads(source)
521-
for icon in array['icons']:
522-
image = download_image(root_url, icon['src'])
523-
if image is not None:
524-
t = tempfile.NamedTemporaryFile(suffix=".png", delete=False)
525-
images.append(["Favicon Grabber", image, t.name])
526-
image.save(t.name)
527-
images = sorted(images, key = lambda x: x[1].height, reverse=True)
528-
if images:
529-
return images
530-
except Exception as e:
531-
print(e)
532-
533-
# Fallback: Check HTML and /favicon.ico
514+
# Check HTML and /favicon.ico
534515
try:
535516
response = requests.get(url, timeout=3)
536517
if response.ok:

0 commit comments

Comments
 (0)