什么都不能做的代码记录
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
相关文章推荐
- Git把本地代码push到oschina git仓库
- #Mac OS X上 安装Ruby运行环境
- python获取堆栈信息的方法
- Python之filter筛选数据工具
- Vim与Python真乃天作之和
- C++的机器学习开源库
- C++特征之多态
- [Laravel] 获取执行的Sql
- EditPlus汉化版安装软件
- Windows 7下的python环境配置
- 5.C# 串口类处理上传传感器数据
- Python之上下文管理器
- PHP closedir() 函数
- python自然语言处理:NLTK+Ubuntu+Eclipse环境配置
- Java中使用正则表达式获取网页中所有图片的路径
- 初探C#
- eclipse svn知识
- PHP - mysql_real_escape_string()与mysql_escape_string() 的区别
- 点击两次退出应用程序
- Python实现PointToRaster