Skip to content

Instantly share code, notes, and snippets.

@lizhaode
lizhaode / aria2.py
Created December 17, 2019 09:48
send aria task by http
import requests
base_url = 'http://1.1.1.1:6800/jsonrpc'
data = {
'jsonrpc': '2.0',
'method': 'aria2.addUri',
'id': '0',
'params': ['token:', ['https://example.com/file'], {'out': 'aaa', 'dir': '/opt/drive/bbb'}]
}
@lizhaode
lizhaode / log.py
Created December 10, 2019 10:01
set log format
logging.basicConfig(format='%(asctime)s %(levelname)s %(thread)d --- [%(name)s-%(threadName)s] %(message)s',level=logging.DEBUG)
@lizhaode
lizhaode / pornhub.py
Created December 4, 2019 06:28
python exec js
from bs4 import BeautifulSoup
import js2py
soup = BeautifulSoup(open('test.html'),'lxml')
div = soup.find(name='div',attrs={'class':'premiumShowTemplate'})
js_content = div.script.string.split('loadScriptUniqueId')[0]
aaa = 'function f(){'+js_content+'if (quality_1080p !== undefined) {return quality_1080p;} else {return quality_720p;}}'