使用两个关键字导航到链接

时间:2020-07-03 04:42:52

标签: javascript node.js web-scraping puppeteer

我正在尝试抓取网页以查找包含两个关键字的商品链接。我遇到了一个问题,当脚本应该检查两个时,脚本会导航到包含两个关键字之一的第一个链接。

这是代码:

from flask import Flask, render_template, url_for, redirect, request, session

app = Flask(__name__)

@app.route('/', methods=["POST", "GET"])
def purchase():
    try:
        
        if request.method == "POST":
            email = request.form["email"]
            # Query the data base to find the exact amount and name of buyer

            session["user"] = email
            return redirect(url_for("proceed"))
            
        else:
            return render_template("index.html",logged_in=True)
            
    except Exception as e:
        return(str(e))


@app.route("/confirm")
def proceed():
    # Get information and create another form
    if "user" in session:
        return f"""<h1>{session["user"]}</h1>"""
    else:
        return f"""<h1>No email found</h1>"""
if __name__ == "__main__":
    
    app.run()

如何获取实际检查两个关键字的信息?还是这样正确,而我的问题出在其他地方?

谢谢。

0 个答案:

没有答案