Форум сайта python.su
0
В html странице есть куски с javascript, подскажите как например выдернуть значение переменой window.authHash
html-код <script type="text/javascript"> window.appId = 1234567; window.authHash = 'data1'; window.authUrl = 'http://site.com/example.php'; createButton(ge('auth_user'), function() { if (window.noAuth) </script> html-код
Офлайн
13
import re
html = """
...
window.authHash = 'data1';
window.authUrl = 'http://site.com/example.php';
createButton(ge('auth_user'), function() {
...
"""
print re.search("window.authHash = '([^']+)", html).group(1)
Офлайн