对,所以我知道如何抓取网站,但是我在使用Python 3登录到要抓取的网站时遇到了麻烦。
我已经包含了该网站使用的HTML。据我了解,这是需要什么?
我尝试了一个简单的解决方案,该解决方案应该可以运行,但不能运行(它似乎无法登录,并直接转到目标URL,跳过登录?)。
Attempted Solution: https://pastebin.com/AEK6Qwnb (I've also tried a solution using RoboBrowser, but I couldn't succeed there either.)
Website HTML: https://pastebin.com/Jp8Zpq2a
让我知道此信息是否足够,我可以尝试提供更多信息。 预先感谢!
答案 0 :(得分:1)
有许多可能的解决方案,具体取决于站点,您的需求和限制以及个人喜好。但是,selenium
可能是直接解决方案<!DOCTYPE html>
<html>
<head>
<title>
Speed Game
</title>
</head>
<body>
<button id="buttonOne" onclick="getResults('buttonOne');">
random number 1
</button>
<button id="buttonTwo" onclick="getResults('buttonTwo')">
random number 2
</button>
</body>
</html>