from flask import Flask, render_template, request from webscout import WEBS import arrow app = Flask(__name__) @app.route('/', methods=['GET']) def home(): keywords = request.args.get('keywords', 'india') timelimit = request.args.get('timelimit', 'y') video_list = [] with WEBS() as webs_instance: WEBS_videos_gen = webs_instance.videos( keywords, region="wt-wt", timelimit=None, safesearch="off", resolution=None, duration=None, max_results=100 ) for r in WEBS_videos_gen: r['published'] = arrow.get(r['published']).humanize() video_list.append(r) return render_template('video.html', video=video_list, keywords=keywords) if __name__ == '__main__': app.run(debug=True)