什么都不能做的代码记录

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 cookies
C = 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




评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值