aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/lib/utils.py
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2015-07-06 11:47:45 +0200
committerFrançois Schmidts <francois.schmidts@gmail.com>2015-07-06 13:54:05 +0200
commitc47e8fbd86eebd4c61888b1cba6cf39670679fd0 (patch)
treeb73d664257c1d4248538f79eb77b5b3d460e25ff /pyaggr3g470r/lib/utils.py
parentlight refact (diff)
downloadnewspipe-c47e8fbd86eebd4c61888b1cba6cf39670679fd0.tar.gz
newspipe-c47e8fbd86eebd4c61888b1cba6cf39670679fd0.tar.bz2
newspipe-c47e8fbd86eebd4c61888b1cba6cf39670679fd0.zip
the icon isn't a url but a b64 dump
Diffstat (limited to 'pyaggr3g470r/lib/utils.py')
-rw-r--r--pyaggr3g470r/lib/utils.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/pyaggr3g470r/lib/utils.py b/pyaggr3g470r/lib/utils.py
index b7e5cafc..280256f6 100644
--- a/pyaggr3g470r/lib/utils.py
+++ b/pyaggr3g470r/lib/utils.py
@@ -1,5 +1,6 @@
import types
import urllib
+import base64
import logging
import requests
from hashlib import md5
@@ -41,8 +42,10 @@ def rebuild_url(url, base_split):
def try_splits(url, *splits):
for split in splits:
- if requests.get(rebuild_url(url, split), verify=False).ok:
- return rebuild_url(url, split)
+ rb_url = rebuild_url(url, split)
+ response = requests.get(rb_url, verify=False, timeout=10)
+ if response.ok and 'html' not in response.headers['content-type']:
+ return base64.b64encode(response.content).decode('utf8')
return None
bgstack15