网页hack程序编写
%~dp0
cmd 2>&1 | "C:\Program Files\Git\usr\bin\tee" pyDownload.log
def download(url, file):
cmd = 'python -m wget %s -o "%s"'%(url, file)
#my_system(cmd)
ret = subprocess.run(cmd, timeout=8).returncode
print(' %s return %d'%(cmd, ret))
if ret != 0:
raise 'error, %s return %d'%(cmd, ret)
def getStrIn(cont, a, b):
p1 = cont.find(a)
p1 = p1 + len(a)
p2 = cont.find(b, p1)
name=cont[p1:p2]
return name
try:
xxx
except:
print("Unexpected error:", sys.exc_info()[0])
try:
response = requests.post('http://www.hzcourse.com/web/refbook/queryAllChapterList', data={'ebookId':ebookId,'token':token})
resp_json = response.json()
except:
print("Unexpected error:", sys.exc_info()[0])
A:不知道
A:没有好办法。 一般是因为网页加载未完成。如果你觉得已经ok了,点一下浏览器的停止按钮就可以
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('http://ebooks.cmanuf.com/all?id=1&type=2&code=AC05')
book = driver.find_element_by_css_selector('#booklist > dd:nth-child(%d) > a'%(i+1))
book_href = book.get_attribute('href')
book_text = book.text
// ==UserScript==
// @name TimeBooking
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.citibank.com.hk/*
// @match https://www.services.online-banking.hsbc.com.hk/*
// @match https://e-banking1.hangseng.com/*
// @match https://ebsnew.boc.cn/*
// @match https://its.bochk.com/cdc.overview.do
// @grant GM_xmlhttpRequest
// ==/UserScript==
(function() {
'use strict';
})();
var xpath='//textarea';
var tags_data_image =document.evaluate(xpath, document, null, XPathResult.ANY_TYPE,null);
var textareavalue='';
var tags=[];
for(var tag=tags_data_image.iterateNext(); tag; tag=tags_data_image.iterateNext())
{
tags.push(tag);
if(tag.value.length>0) {
textareavalue = tag.value;
}
}
function _x(STR_XPATH) {
var xresult = document.evaluate(STR_XPATH, document, null, XPathResult.ANY_TYPE, null);
var xnodes = [];
var xres;
while (xres = xresult.iterateNext()) {
xnodes.push(xres);
}
return xnodes;
}
$(_x('/html/.//div[@id="text"]')).attr('id', 'modified-text');
console.log(...)
var currentLocation = window.location;
currentLocation.host
s.indexOf('citibank')
var sFinal = {"value1":s2, "value2":today};
alert(JSON.stringify(sFinal));
GM_xmlhttpRequest ( {
method: "POST",
url: 'https://maker.ifttt.com/trigger/bankmoney/with/key/feQcXd0QuePnJb23E97bv',
data: JSON.stringify(sFinal),
headers: {
"Content-Type": "application/json"
},
onload: function (response) {
console.log ("gut response " + response);
alert("Success " + response);
}
} );
function insertAfter(newElement,targetElement) {
//target is what you want it to go after. Look for this elements parent.
var parent = targetElement.parentNode;
//if the parents lastchild is the targetElement...
if(parent.lastchild == targetElement) {
//add the newElement after the target element.
parent.appendChild(newElement);
} else {
// else the target has siblings, insert the new element between the target and it's next sibling.
parent.insertBefore(newElement, targetElement.nextSibling);
}
}
var btn = document.createElement("a");
btn.innerText='DoMyTask!';
btn.addEventListener("click",updateAll);
btn.setAttribute('color','red');
debugger;
window.addEventListener('load', function() {
var checkExist = setInterval(function() {
if (getRefObject()!=null) {
console.log("Exists!");
main();
clearInterval(checkExist);
}
}, 1000); // check every 100ms
}, false);
var matches = document.querySelectorAll(".adaver_box, #div-ad-top, #adHeaderTop, #adFlashLink, *[id^='adRectangle'], #adTextLink, *[id^='divSkyscraper'], *[id^='div-ad-'], *[id^='google_ads'], .anv-ad-content");
matches.forEach(function(element){
element.parentNode.removeChild(element);
});
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
$('a[onmousedown^="return rwt("]').removeAttr('onmousedown');
$('li.action-menu-item.ab_dropdownitem a[href^="http://webcache.googleusercontent."]').each(
function() {
$(this).closest('div.action-menu.ab_ctl').after(' ').after($(this))
}
)
原文:https://www.cnblogs.com/cutepig/p/12263568.html