[Python] 纯文本查看 复制代码 import re
html = '''
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta content="always" name="referrer"/>
</head>
<body>
<script th:inline="javascript">
/*<![CDATA[*/
function bol(){
if (top.location != self.location) {
return false;
}
var real_jump_address = 'https://s.click.taobao.com/t?union_lens=lensId%3AOPT%401637582776%402127e372_0abc_17d478a2761_d05d%4001&e=m%3D2%26s%3DYL1tGTdtXOVw4vFB6t2Z2ueEDrYVVa64MljcGUdc4HdyINtkUhsv0KDj0kgG4W%2FNLknuM4vEeqn%2F6YnwB7gmRrxYepXMO9dPPcPHeFJh09g1WmX40VYCe7wJBiNCwGbxR04roaaYUn7w%2FaGe1QkIvmV10D5zBFYES5q3ysAI%2BkNjitB%2FgBeFdiGFCzYOOqAQ&sc=QBqSadu&ref=&et=BpKSJDdI%2FJX9tfjMrBZU1s%2BxBfpuECwQ'
if (!window.attachEvent) {
document.write('<input style="display:none" type="button" id="exe" value="">');
document.getElementById('exe').click();
} else {
document.write('<a style="display:none" href="' + real_jump_address + '" id="exe"></a>');
document.getElementById('exe').click();
}
}//end of bol()
bol();
/*]]>*/
</script>
</body>
</html>
'''
url = ''.join(re.findall(r"real_jump_address = '([\s\S]*?)'", html))
print(url) |