added url parameter for searched site
This commit is contained in:
parent
32b051f890
commit
6d85960644
|
|
@ -1,4 +1,6 @@
|
||||||
Flask-URL-Checker
|
Flask-URL-Checker
|
||||||
|
|
||||||
|
For local hosting only. Hosting this application for external users is not recommmended, as it exposes the hoster to potential security risks.
|
||||||
|
|
||||||
### Google.de:
|
### Google.de:
|
||||||

|

|
||||||
15
app.py
15
app.py
|
|
@ -14,6 +14,8 @@ def graph(url):
|
||||||
obj = sitemapper.url(url)
|
obj = sitemapper.url(url)
|
||||||
obj.run_check(url)
|
obj.run_check(url)
|
||||||
|
|
||||||
|
current = os.path.dirname(__file__)
|
||||||
|
|
||||||
nodes = []
|
nodes = []
|
||||||
drawn = []
|
drawn = []
|
||||||
for key, values in obj.sites.items():
|
for key, values in obj.sites.items():
|
||||||
|
|
@ -34,14 +36,16 @@ def graph(url):
|
||||||
for value in values:
|
for value in values:
|
||||||
edges.append('{' + "from: '{}', to: '{}'".format(key, value) + '}')
|
edges.append('{' + "from: '{}', to: '{}'".format(key, value) + '}')
|
||||||
|
|
||||||
with open('./cached/' + url.rsplit('/')[2] + '.json', 'w', encoding='utf-8') as f:
|
with open(os.path.join(current, './cached/' + url.rsplit('/')[2] + '.json'), 'w', encoding='utf-8') as f:
|
||||||
f.write(json.dumps({"nodes": nodes,"edges": edges}))
|
f.write(json.dumps({"nodes": nodes,"edges": edges}))
|
||||||
|
|
||||||
return nodes, edges
|
return nodes, edges
|
||||||
|
|
||||||
|
|
||||||
def load(url):
|
def load(url):
|
||||||
with open('./cached/{}.json'.format(url), 'r', encoding='utf-8') as f:
|
print("Loaded from cache: " + url)
|
||||||
|
current = os.path.dirname(__file__)
|
||||||
|
with open(os.path.join(current,'./cached/{}.json'.format(url)), 'r', encoding='utf-8') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
jsonContent = json.loads(content)
|
jsonContent = json.loads(content)
|
||||||
nodes = jsonContent["nodes"]
|
nodes = jsonContent["nodes"]
|
||||||
|
|
@ -51,12 +55,13 @@ def load(url):
|
||||||
#----------------------------------------------------------------------------#
|
#----------------------------------------------------------------------------#
|
||||||
# Controllers.
|
# Controllers.
|
||||||
#----------------------------------------------------------------------------#
|
#----------------------------------------------------------------------------#
|
||||||
|
# input for urls over url
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
#url = request.args.get("url")
|
url = request.args.get("url")
|
||||||
url = "https://www.google.de"
|
|
||||||
cached = os.listdir("./cached")
|
cached = os.listdir(os.path.join(os.path.dirname(__file__), "./cached"))
|
||||||
withoutProtocol = url.rsplit('/')[2]
|
withoutProtocol = url.rsplit('/')[2]
|
||||||
if withoutProtocol + '.json' not in cached:
|
if withoutProtocol + '.json' not in cached:
|
||||||
nodes, edges = graph(url)
|
nodes, edges = graph(url)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"nodes": ["{id: 'https://budgetbytes.lpages.co/budget-bytes-app/', label: 'budget-bytes-app', group: 0}", "{id: 'https://itunes.apple.com/app/apple-store/id1240079167?pt=95954917&ct=Landing%20page&mt=8', label: 'https://itunes.apple.com/app/apple-store/id1240079167?pt=95954917&ct=Landing%20page&mt=8', group: 1}", "{id: 'https://goo.gl/wiZ4FQ', label: 'https://goo.gl/wiZ4FQ', group: 1}", "{id: 'mailto:budgetbytesapp@sidechef.com', label: 'mailto:budgetbytesapp@sidechef.com', group: 1}", "{id: 'https://www.budgetbytes.com/', label: 'https://www.budgetbytes.com/', group: 1}", "{id: 'https://www.sidechef.com/', label: 'https://www.sidechef.com/', group: 1}"], "edges": ["{from: 'https://budgetbytes.lpages.co/budget-bytes-app/', to: 'https://itunes.apple.com/app/apple-store/id1240079167?pt=95954917&ct=Landing%20page&mt=8'}", "{from: 'https://budgetbytes.lpages.co/budget-bytes-app/', to: 'https://goo.gl/wiZ4FQ'}", "{from: 'https://budgetbytes.lpages.co/budget-bytes-app/', to: 'mailto:budgetbytesapp@sidechef.com'}", "{from: 'https://budgetbytes.lpages.co/budget-bytes-app/', to: 'https://www.budgetbytes.com/'}", "{from: 'https://budgetbytes.lpages.co/budget-bytes-app/', to: 'https://www.sidechef.com/'}"]}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"nodes": ["{id: 'https://patricematz.de/', label: 'patricematz.de', group: 0}", "{id: 'https://patricematz.de/images/praktikum.pdf', label: 'praktikum.pdf', group: 0}", "{id: 'https://patricematz.de/images/bachelor.pdf', label: 'bachelor.pdf', group: 0}", "{id: 'https://github.com/Askill/Photo-Wall', label: 'https://github.com/Askill/Photo-Wall', group: 1}", "{id: 'https://www.jpmatz.de/blog.html', label: 'https://www.jpmatz.de/blog.html', group: 1}", "{id: 'https://fs.jpmatz.de', label: 'https://fs.jpmatz.de', group: 1}", "{id: 'https://github.com/Askill/mosaik', label: 'https://github.com/Askill/mosaik', group: 1}", "{id: 'https://github.com/Askill/Flask-URL-Checker', label: 'https://github.com/Askill/Flask-URL-Checker', group: 1}", "{id: 'https://github.com/Askill/UI', label: 'https://github.com/Askill/UI', group: 1}", "{id: 'https://www.linkedin.com/in/patrice-matz-b73b6814a/', label: 'https://www.linkedin.com/in/patrice-matz-b73b6814a/', group: 1}", "{id: 'https://github.com/Askill', label: 'https://github.com/Askill', group: 1}"], "edges": ["{from: 'https://patricematz.de/', to: 'https://github.com/Askill/Photo-Wall'}", "{from: 'https://patricematz.de/', to: 'https://www.jpmatz.de/blog.html'}", "{from: 'https://patricematz.de/', to: 'https://fs.jpmatz.de'}", "{from: 'https://patricematz.de/', to: 'https://github.com/Askill/mosaik'}", "{from: 'https://patricematz.de/', to: 'https://github.com/Askill/Flask-URL-Checker'}", "{from: 'https://patricematz.de/', to: 'https://github.com/Askill/UI'}", "{from: 'https://patricematz.de/', to: 'https://www.linkedin.com/in/patrice-matz-b73b6814a/'}", "{from: 'https://patricematz.de/', to: 'https://github.com/Askill'}", "{from: 'https://patricematz.de/', to: 'https://patricematz.de/images/praktikum.pdf'}", "{from: 'https://patricematz.de/', to: 'https://patricematz.de/images/bachelor.pdf'}"]}
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -15,10 +15,6 @@ class url:
|
||||||
'User-Agent': 'Mozilla 4/0'}
|
'User-Agent': 'Mozilla 4/0'}
|
||||||
|
|
||||||
exclude = {
|
exclude = {
|
||||||
"title=Spezial",
|
|
||||||
"doodles/",
|
|
||||||
"#",
|
|
||||||
"&"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, url):
|
def __init__(self, url):
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
var nodes = [{{ nodes | safe }}] ;
|
var nodes = [{{ nodes | safe }}] ;
|
||||||
|
|
||||||
var edges = [{{ edges | safe }}] ;
|
var edges = [{{ edges | safe }}] ;
|
||||||
|
console.log(nodes, edges);
|
||||||
// create a network
|
// create a network
|
||||||
var container = document.getElementById('mynetwork');
|
var container = document.getElementById('mynetwork');
|
||||||
var data = {
|
var data = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue