N2ITN/are-you-fake-news

You can't share the search result

lucasduffey opened this issue · 3 comments

After searching for a site, the url remains http://areyoufakenews.com/, it should be something like http://areyoufakenews.com?site=evilnews.com so you can easily share the results with people

N2ITN commented

I agree! I'm open to pull requests if anyone knows flask and wants to fix it.

relevant: https://github.com/N2ITN/newscraper/blob/be968db3246e43959c01a6e6b048d92fecaaa61e/web/app.py#L54

Not sure if it's as simple as changing to if request.method in ['POST', 'GET']:

will have to check in free time

N2ITN commented

I don't have a chance to try it at this moment, but while we're brainstorming:
It might just be a matter of defining a new function for the main function def hello() to call using a dynamically generated app route, instead of returning the template in its own scope:

Something like:

@app.route(f"/results_{name_clean}", methods=['GET', 'POST'])
def user_results(val,pol,fact):
    return render template('index.html', value=val, pol=pol, fact=fact)

(where name_clean is the top level domain of the url with no punctuation)