您的位置:首页 > 编程语言

什么都不能做的代码记录

2015-11-07 10:49 267 查看
from ctypes import *

from win32gui import *
from win32process import *
from win32api import *
from win32con import *
import win32clipboard

def paste():
win32clipboard.OpenClipboard()
data = win32clipboard.GetClipboardData(win32clipboard.CF_UNICODETEXT)
win32clipboard.CloseClipboard()
return data

activeWinPtr = GetForegroundWindow()
activeThreadId = GetWindowThreadProcessId(activeWinPtr)[0]
currentThreadId = GetCurrentThreadId()

if (activeThreadId != currentThreadId):
AttachThreadInput(activeThreadId, currentThreadId, True)
activeCtrlId = GetFocus()

textlength = SendMessage(
activeCtrlId, WM_GETTEXTLENGTH, 0, 0) + 1

print(textlength)

if (textlength > 0):

selstart = None
selend = None
SendMessage(activeCtrlId, EM_GETSEL, selstart, selend)

sb = create_unicode_buffer(textlength)
SendMessage(activeCtrlId, WM_GETTEXT, textlength, sb)

print(sb.value)
#     //Slice out selection
value = sb.value

SendMessage(activeCtrlId, WM_COPY, 0, 0)
print(paste())
queryUrl = 'http://media3.icourses.cn/process4/campus/processres/flv/2013/8/17/ff808081-40870604-0140-884dc539-0007.flv?lv=150606-1<=11-13/17:8:26&ls=play&h=9th76XiynBeAoGkPAopnIw&r=1479028093&p=151020&start=0'# # print(queryUrl)userAgent = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36'from http import cookiesC = cookies.SimpleCookie()C.load('route=50eb4aa12ccd77d880701174e499c93e; icoursesSymbol=wKg3KFgoJNxHYX34CqonAg==; TJ_VISIT=1479025996051; TJ_PVT=1479028101684; Hm_lvt_787dbcb72bb32d4789a985fd6cd53a46=1479026000; Hm_lpvt_787dbcb72bb32d4789a985fd6cd53a46=1479028102')jar = requests.cookies.RequestsCookieJar()jar.update(C)r = requests.get(queryUrl, cookies=jar, headers={'User-Agent': userAgent, 'Referer': 'http://www.icourses.cn/jpk/changeforVideo.action?resId=470500&courseId=3724&firstShowFlag=1','X-Requested-With': 'ShockwaveFlash/23.0.0.166','Host': 'media3.icourses.cn','Connection': 'keep-alive','Cache-Control': 'max-age=0','Accept': '*/*','Accept-Encoding': 'gzip, deflate, sdch','Accept-Language': 'zh-CN,zh;q=0.8'})  # stream=True,print(r.status_code)  # r.text , r.history, r.text,lastChild

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: