Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove call to favicongrabber.com #328

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions usr/lib/webapp-manager/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import configparser
import gettext
from io import BytesIO
import json
import locale
import os
from random import choice
Expand Down Expand Up @@ -512,25 +511,7 @@ def download_favicon(url):
(scheme, netloc, path, _, _, _) = urllib.parse.urlparse(url)
root_url = "%s://%s" % (scheme, netloc)

# try favicon grabber first
try:
response = requests.get("https://favicongrabber.com/api/grab/%s?pretty=true" % netloc, timeout=3)
if response.status_code == 200:
source = response.content.decode("UTF-8")
array = json.loads(source)
for icon in array['icons']:
image = download_image(root_url, icon['src'])
if image is not None:
t = tempfile.NamedTemporaryFile(suffix=".png", delete=False)
images.append(["Favicon Grabber", image, t.name])
image.save(t.name)
images = sorted(images, key = lambda x: x[1].height, reverse=True)
if images:
return images
except Exception as e:
print(e)

# Fallback: Check HTML and /favicon.ico
# Check HTML and /favicon.ico
try:
response = requests.get(url, timeout=3)
if response.ok:
Expand Down
Loading