[AHK] 定义热键控制酷狗音乐播放器

news/2024/2/21 3:13:25

==================最新版本====================

1、请ahk官网下载ahk环境,约3M,安装u32版本。

2、将本脚本存成.ahk文件,双击运行。

3、热键说明Capslock+[为上一首

Capslock+]  为下一首

Capslock+|  为播放/暂停

Capslock+d 为收藏/取消收藏

;功能:用ACC技术控制酷狗播放器
;作者:sunwind
;微信:sunwind1576157
;版本:V0.2
;发布地址:https://blog.csdn.net/liuyukuan/article/details/108029699
;2021年11月2日优化:适应酷狗新版本2021/2/19  9229(0.2.35) ,以及以后的2021/9/23 10021#Persistent
#SingleInstance,force
SetBatchLines,-1
SetTitleMatchMode, 2
Run "C:\Program Files (x86)\KuGou\KGMusic\KuGou.exe";播放上一首
CapsLock & [::酷狗音乐("上一首")
;播放下一首
CapsLock & ]::酷狗音乐("下一首");播放/暂停
CapsLock & |::
AccKugo := Acc_ObjectFromWindow(WinExist("酷狗音乐 ahk_class kugou_ui"))
if (GetElementByName(AccKugo, "播放").accName(0)="播放")酷狗音乐("播放")
else酷狗音乐("暂停")
return;收藏/取消收藏
CapsLock & d::
AccKugo := Acc_ObjectFromWindow(WinExist("酷狗音乐 ahk_class kugou_ui"))
if (GetElementByName(AccKugo, "我喜欢").accName(0)="我喜欢")酷狗音乐("我喜欢")
else酷狗音乐("取消喜欢")
return酷狗音乐(命令)
{AccKugo := Acc_ObjectFromWindow(WinExist("酷狗音乐 ahk_class kugou_ui"))GetElementByName(AccKugo, 命令).accDoDefaultAction(0)return
}GetElementByName(AccObj, name) {if (AccObj.accName(0) = name)return AccObjfor k, v in Acc_Children(AccObj)if IsObject(obj := GetElementByName(v, name))return obj
}; The code below is part of the Acc.ahk Standard Library by Sean (updated by jethrow)
; Found at http://autohotkey.com/board/topic/77303-/?p=491516Acc_Init()
{static hIf Not hh:=DllCall("LoadLibrary","Str","oleacc","Ptr")
}
Acc_ObjectFromWindow(hWnd, idObject = 0)
{Acc_Init()If DllCall("oleacc\AccessibleObjectFromWindow", "Ptr", hWnd, "UInt", idObject&=0xFFFFFFFF, "Ptr", -VarSetCapacity(IID,16)+NumPut(idObject==0xFFFFFFF0?0x46000000000000C0:0x719B3800AA000C81,NumPut(idObject==0xFFFFFFF0?0x0000000000020400:0x11CF3C3D618736E0,IID,"Int64"),"Int64"), "Ptr*", pacc)=0Return ComObjEnwrap(9,pacc,1)
}
Acc_Query(Acc) {Try Return ComObj(9, ComObjQuery(Acc,"{618736e0-3c3d-11cf-810c-00aa00389b71}"), 1)
}
Acc_Children(Acc) {If ComObjType(Acc,"Name") != "IAccessible"ErrorLevel := "Invalid IAccessible Object"Else {Acc_Init(), cChildren:=Acc.accChildCount, Children:=[]If DllCall("oleacc\AccessibleChildren", "Ptr",ComObjValue(Acc), "Int",0, "Int",cChildren, "Ptr",VarSetCapacity(varChildren,cChildren*(8+2*A_PtrSize),0)*0+&varChildren, "Int*",cChildren)=0 {Loop %cChildren%i:=(A_Index-1)*(A_PtrSize*2+8)+8, child:=NumGet(varChildren,i), Children.Insert(NumGet(varChildren,i-8)=9?Acc_Query(child):child), NumGet(varChildren,i-8)=9?ObjRelease(child):Return Children.MaxIndex()?Children:} ElseErrorLevel := "AccessibleChildren DllCall Failed"}
}

==================以下为早期版本====================

1、先识别,再绑定热键

2、利用ACC技术来识别非标窗口的按钮, 需要用 Accview工具查看按钮的Name属性

3、全部源代码如下,F4键绑定为播放/暂停功能,其它热键类同:

;功能:用ACC技术控制酷狗播放器
;作者:sunwind
;微信:sunwind1576157
;版本:V0.1#Persistent
#SingleInstance,force
SetBatchLines,-1
SetTitleMatchMode, 2F2::酷狗音乐("上一首")
F3::酷狗音乐("下一首")
F4::酷狗音乐("播放/暂停")
F5::酷狗音乐("我喜欢")
return酷狗音乐(命令)
{AccKugo := Acc_ObjectFromWindow(WinExist("酷狗音乐 ahk_class kugou_ui"))GetElementByName(AccKugo, 命令).accDoDefaultAction(0)return
}GetElementByName(AccObj, name) {if (AccObj.accName(0) = name)return AccObjfor k, v in Acc_Children(AccObj)if IsObject(obj := GetElementByName(v, name))return obj
}; The code below is part of the Acc.ahk Standard Library by Sean (updated by jethrow)
; Found at http://autohotkey.com/board/topic/77303-/?p=491516Acc_Init()
{static hIf Not hh:=DllCall("LoadLibrary","Str","oleacc","Ptr")
}
Acc_ObjectFromWindow(hWnd, idObject = 0)
{Acc_Init()If DllCall("oleacc\AccessibleObjectFromWindow", "Ptr", hWnd, "UInt", idObject&=0xFFFFFFFF, "Ptr", -VarSetCapacity(IID,16)+NumPut(idObject==0xFFFFFFF0?0x46000000000000C0:0x719B3800AA000C81,NumPut(idObject==0xFFFFFFF0?0x0000000000020400:0x11CF3C3D618736E0,IID,"Int64"),"Int64"), "Ptr*", pacc)=0Return ComObjEnwrap(9,pacc,1)
}
Acc_Query(Acc) {Try Return ComObj(9, ComObjQuery(Acc,"{618736e0-3c3d-11cf-810c-00aa00389b71}"), 1)
}
Acc_Children(Acc) {If ComObjType(Acc,"Name") != "IAccessible"ErrorLevel := "Invalid IAccessible Object"Else {Acc_Init(), cChildren:=Acc.accChildCount, Children:=[]If DllCall("oleacc\AccessibleChildren", "Ptr",ComObjValue(Acc), "Int",0, "Int",cChildren, "Ptr",VarSetCapacity(varChildren,cChildren*(8+2*A_PtrSize),0)*0+&varChildren, "Int*",cChildren)=0 {Loop %cChildren%i:=(A_Index-1)*(A_PtrSize*2+8)+8, child:=NumGet(varChildren,i), Children.Insert(NumGet(varChildren,i-8)=9?Acc_Query(child):child), NumGet(varChildren,i-8)=9?ObjRelease(child):Return Children.MaxIndex()?Children:} ElseErrorLevel := "AccessibleChildren DllCall Failed"}
}

以下是网友飞跃写的代码,考虑了不同版本酷狗的兼容性问题,供参考:

/*
;-----------------------------------
;  ACC控制酷狗音乐 - By FeiYue
;
;  备注:热键可以改为自己喜欢的
;-----------------------------------
*/#NoEnv;-- 获取【Acc路径】及其他信息
F1::
obj:=Acc_GetInfoUnderCursor()
MsgBox, 4096,, % "Path = " obj.Path. "`nTitle = " obj.Title "`nClass = " obj.Class. "`nRole = " obj.Role "`nState = " obj.State. "`nName = " obj.Name "`nValue = " SubStr(obj.Value,1,100)
return;-- 获取所有【Acc路径】及文本
F8::
MouseGetPos,,, id
MsgBox, 4096,, % Clipboard:="". Acc_GetAllText(id, info:={role:"", name:"", value:""})
returnF2:: 酷狗音乐("上一首")F3:: 酷狗音乐("下一首")F4:: 酷狗音乐("播放/暂停")F5:: 酷狗音乐("我喜欢")酷狗音乐(命令)
{SetBatchLines, -1SetTitleMatchMode, 2DetectHiddenWindows, OnWinGet, List, List, 酷狗音乐 ahk_exe KuGou.exeIfLess, List, 1, returnLoop, % List{id:=List%A_Index%WinGetPos,,, w, h, ahk_id %id%if (A_Index=1 or w*h>max)okid:=id, max:=w*h}酷狗9:={ "上一首"   : "4.2.X.16.1|4.3.X.16.1", "播放/暂停" : "4.2.X.16.2|4.3.X.16.2", "下一首"    : "4.2.X.16.3|4.3.X.16.3", "我喜欢"    : "4.2.X.15.1|4.3.X.15.1" }酷狗8:={ "上一首"   : "4.3.7.13.1", "播放/暂停" : "4.3.7.13.3", "下一首"    : "4.3.7.13.2", "我喜欢"    : "4.3.7.X.5" }For k,v in [酷狗9, 酷狗8]For k2,v2 in StrSplit(v[命令], "|")if (arr:=Acc_GetObjectFromPath(okid, v2, {name:命令})){Try arr[1].accDoDefaultAction(arr[2])msgbox % arr[2]return}
};==================================================Acc_GetAllText(hwnd, info="", first=1)
{static arr, textif (first)arr:=[], text:="", hwnd:=Acc_ObjectFromWindow(hwnd, 0)arr.Push(0)For i,v in Acc_Children(Acc:=hwnd){arr[arr.length()]++, path:=""Loop, % arr.length()path.=(A_Index=1 ? "" : ".") . arr[A_Index]Role:=Name:=Value:="", j:=IsObject(v)Try Role:=j ? v.accRole(0) : Acc.accRole(v)Try Name:=j ? v.accName(0) : Acc.accName(v)Try Value:=j ? v.accValue(0) : Acc.accValue(v)path:=j ? path : RegExReplace(path, "(\w+)$", "c$1")if (!info.role||Role=info.role)and (!info.name||Name~=info.name)and (!info.value||Value~=info.value)text.=path " ---- " Acc_GetRoleText(Role) " ". Format("0x{:X}",Role) " [" SubStr(Name,1,60). "][" SubStr(Value,1,60) "]`r`n"if (j)Acc_GetAllText(v, info, 0)}arr.Pop()if (first)return (s:=text, text:="") ? s:s
}Acc_GetObjectFromPath(hwnd, path, info="", Acc=0, first=1)
{if (first)hwnd:=Acc_ObjectFromWindow(hwnd, 0)if !IsObject(v:=hwnd) and !IsObject(Acc)returnLoop, Parse, path, ., c C{if !IsObject(Acc:=v)returnif (i:=A_LoopField)="X"{path:=Trim(SubStr(path, InStr(path,"X")+1), ".")For k,v in Acc_Children(Acc)if (arr:=Acc_GetObjectFromPath(v,path,info,Acc,0))return arrreturn}if (j:=Acc.accChildCount)<i or (j<1)returnv:=Acc_Children(Acc,i)}Role:=Name:=Value:="", j:=IsObject(v)Try Role:=j ? v.accRole(0) : Acc.accRole(v)Try Name:=j ? v.accName(0) : Acc.accName(v)Try Value:=j ? v.accValue(0) : Acc.accValue(v)if (!info.role||Role=info.role)and (!info.name||Name~=info.name)and (!info.value||Value~=info.value)return (j ? [v,0] : [Acc,v])
}Acc_GetInfoUnderCursor()
{; MouseGetPos,,,, cid, 2; SendMessage, WM_GETOBJECT:=0x3D, 0, 1,, ahk_id %cid%Acc:=Acc_ObjectFromPoint(child)Try Name:=Acc.accName(child)Try Value:=Acc.accValue(child)Try Role:=Format("0x{:X}", Acc.accRole(child))Try State:=Format("0x{:X}", Acc.accState(child))path:=Acc_GetAccPath(Acc, child, hwnd)WinGetTitle, title, ahk_id %hwnd%WinGetClass, class, ahk_id %hwnd%return { Path:path, Hwnd:hwnd, Title:title, Class:class, Name:Name, Value:Value, Role:Role, State:State }
}Acc_GetAccPath(Acc, ChildID, ByRef hwnd)
{static DesktopHwnd:=DllCall("GetDesktopWindow", "ptr")hwnd:=PreHwnd:=t2:=""While AccHwnd:=Acc_WindowFromObject(Parent:=Acc_Parent(Acc)){t1:=(ChildID=0?"":"c") . Acc_GetEnumIndex(Acc, ChildID)if (PreHwnd!="" && AccHwnd!=PreHwnd)hwnd:=PreHwndif (t1="" || AccHwnd=DesktopHwnd)Breakt2:=t1 "." t2, PreHwnd:=AccHwnd, (ChildID=0 ? Acc:=Parent:""), ChildID:=0}return SubStr(t2,1,-1)
}Acc_GetEnumIndex(Acc, ChildID=0)
{Role:=State:=Name:=""Try Role :=Acc.accRole(ChildID)Try State:=Acc.accState(ChildID)Try Name :=Acc.accName(ChildID)Pos:=Acc_Location(Acc,ChildID).posCount:=Acc.accChildCountif (ChildID!=0){For Each, child in Acc_Children(Acc)if !IsObject(child){vRole:=vState:=vName:=""Try vRole :=Acc.accRole(child)Try vState:=Acc.accState(child)Try vName :=Acc.accName(child)if (vRole=Role) and (vState=State) and (vName=Name)and (Acc_Location(Acc,child).pos=Pos)return A_Index}return}For Each, child in Acc_Children(Acc_Parent(Acc))if IsObject(child){vRole:=vState:=vName:=""Try vRole :=child.accRole(0)Try vState:=child.accState(0)Try vName :=child.accName(0)if (vRole=Role) and (vState=State) and (vName=Name)and (child.accChildCount=Count)and (Acc_Location(child).pos=Pos)return A_Index}
}; Acc.ahk - thanks Sean, jethrow, jeeswg, teadrinker
Acc_Get(Cmd, ChildPath="", ChildID=0, WinTitle="", WinText="", ExcludeTitle="", ExcludeText="")
{static properties := {Action:"DefaultAction", DoAction:"DoDefaultAction", Keyboard:"KeyboardShortcut"}AccObj := IsObject(WinTitle) ? WinTitle:  Acc_ObjectFromWindow( WinExist(WinTitle, WinText, ExcludeTitle, ExcludeText), 0 )if ComObjType(AccObj, "Name") != "IAccessible"ErrorLevel := "Could not access an IAccessible Object"else{if RegExMatch(ChildPath,"\.[cC](\w+)$",r)ChildPath:=SubStr(ChildPath,1,-StrLen(r)), ChildID:=r1StringReplace, ChildPath, ChildPath, _, %A_Space%, AllAccError:=Acc_Error(), Acc_Error(true)Loop, Parse, ChildPath, ., %A_Space%try{if A_LoopField is digitChildren:=Acc_Children(AccObj), m2:=A_LoopField ; mimic "m2" output in else-statementelseRegExMatch(A_LoopField, "(\D*)(\d*)", m), Children:=Acc_ChildrenByRole(AccObj, m1), m2:=(m2?m2:1)if Not Children.HasKey(m2)throwAccObj := Children[m2]}catch{ErrorLevel:="Cannot access ChildPath Item #" A_Index " -> " A_LoopField, Acc_Error(AccError)if Acc_Error()throw Exception("Cannot access ChildPath Item", -1, "Item #" A_Index " -> " A_LoopField)return}Acc_Error(AccError)StringReplace, Cmd, Cmd, %A_Space%, , Allproperties.HasKey(Cmd)? Cmd:=properties[Cmd]:""try{if (Cmd = "Location")ret_val := Acc_Location(AccObj,ChildId+0).poselse if (Cmd = "Object")ret_val := AccObjelse if Cmd in Role,Stateret_val := Acc_%Cmd%(AccObj, ChildID+0)else if Cmd in ChildCount,Selection,Focusret_val := AccObj["acc" Cmd]elseret_val := AccObj["acc" Cmd](ChildID+0)}catch{ErrorLevel := """" Cmd """ Cmd Not Implemented"if Acc_Error()throw Exception("Cmd Not Implemented", -1, Cmd)return}return ret_val, ErrorLevel:=0}if Acc_Error()throw Exception(ErrorLevel,-1)
}Acc_Location(Acc, ChildId=0)  ; adapted from Sean's code
{try Acc.accLocation(ComObj(0x4003,&x:=0), ComObj(0x4003,&y:=0), ComObj(0x4003,&w:=0), ComObj(0x4003,&h:=0), ChildId)catchreturnreturn { x:NumGet(x,0,"int"), y:NumGet(y,0,"int"), w:NumGet(w,0,"int"), h:NumGet(h,0,"int"), pos:"x" NumGet(x,0,"int")" y" NumGet(y,0,"int"). " w" NumGet(w,0,"int") " h" NumGet(h,0,"int") }
}Acc_Parent(Acc)
{try parent:=Acc.accParentreturn parent?Acc_Query(parent):""
}Acc_Child(Acc, ChildId=0)
{try child:=Acc.accChild(ChildId)return child?Acc_Query(child):""
}Acc_Init()
{Static hIf (!h)h:=DllCall("LoadLibrary","Str","oleacc","Ptr")
}Acc_WindowFromObject(pacc)
{Acc_Init()If  DllCall("oleacc\WindowFromAccessibleObject", "Ptr", IsObject(pacc)?ComObjValue(pacc):pacc, "Ptr*", hWnd)=0return hWnd
}Acc_ObjectFromEvent(ByRef _idChild_, hWnd, idObject, idChild)
{Acc_Init()If  DllCall("oleacc\AccessibleObjectFromEvent", "Ptr", hWnd, "UInt", idObject, "UInt", idChild, "Ptr*", pacc, "Ptr", VarSetCapacity(varChild,8+2*A_PtrSize,0)*0+&varChild)=0return ComObjEnwrap(9,pacc,1), _idChild_:=NumGet(varChild,8,"UInt")
}Acc_ObjectFromPoint(ByRef _idChild_ = "", x = "", y = "")
{Acc_Init()If  DllCall("oleacc\AccessibleObjectFromPoint", "Int64", x==""||y==""? 0*DllCall("GetCursorPos","Int64*",pt)+pt:x&0xFFFFFFFF|y<<32, "Ptr*", pacc, "Ptr", VarSetCapacity(varChild,8+2*A_PtrSize,0)*0+&varChild)=0return ComObjEnwrap(9,pacc,1), _idChild_:=NumGet(varChild,8,"UInt")
}Acc_ObjectFromWindow(hWnd, idObject = -4)
{Acc_Init()If DllCall("oleacc\AccessibleObjectFromWindow", "Ptr", hWnd, "UInt", idObject&=0xFFFFFFFF, "Ptr", (VarSetCapacity(IID,16)+NumPut(idObject==0xFFFFFFF0?0x0000000000020400:0x11CF3C3D618736E0,IID,"Int64")+NumPut(idObject==0xFFFFFFF0?0x46000000000000C0:0x719B3800AA000C81,IID,8,"Int64"))*0+&IID, "Ptr*", pacc)=0return ComObjEnwrap(9,pacc,1)
}Acc_Children(Acc, N="")
{if ComObjType(Acc,"Name") != "IAccessible"ErrorLevel := "Invalid IAccessible Object"else{Acc_Init(), cChildren:=Acc.accChildCount, Children:=[]if DllCall("oleacc\AccessibleChildren", "Ptr",ComObjValue(Acc), "Int",0, "Int",cChildren, "Ptr",VarSetCapacity(varChildren, cChildren*(8+2*A_PtrSize),0)*0+&varChildren, "Int*",cChildren)=0{ListLines, % (lls:=A_ListLines=0?"Off":"On")?"Off":"Off"SetBatchLines, % (bch:=A_BatchLines)?"-1":"-1"Loop, %cChildren%i:=(A_Index-1)*(A_PtrSize*2+8), child:=NumGet(varChildren,i+8), Children[A_Index]:=( (j:=NumGet(varChildren,i)=9)&& (N=""||N=A_Index) ? Acc_Query(child):child ), (j ? ObjRelease(child):"")SetBatchLines, %bch%ListLines, %lls%return Children.MaxIndex()?(N=""?Children:Children[N]):""} elseErrorLevel := "AccessibleChildren DllCall Failed"}if Acc_Error()throw Exception(ErrorLevel,-1)
}Acc_ChildrenByRole(Acc, Role)
{if ComObjType(Acc,"Name")!="IAccessible"ErrorLevel := "Invalid IAccessible Object"else{Acc_Init(), cChildren:=Acc.accChildCount, Children:=[]if DllCall("oleacc\AccessibleChildren", "Ptr",ComObjValue(Acc), "Int",0, "Int",cChildren, "Ptr",VarSetCapacity(varChildren, cChildren*(8+2*A_PtrSize),0)*0+&varChildren, "Int*",cChildren)=0{Loop, %cChildren%{i:=(A_Index-1)*(A_PtrSize*2+8)+8, child:=NumGet(varChildren,i)if NumGet(varChildren,i-8)=9AccChild:=Acc_Query(child), ObjRelease(child), Acc_Role(AccChild)=Role?Children.Push(AccChild):""elseAcc_Role(Acc, child)=Role?Children.Push(child):""}return Children.MaxIndex()?Children:"", ErrorLevel:=0} elseErrorLevel := "AccessibleChildren DllCall Failed"}if Acc_Error()throw Exception(ErrorLevel,-1)
}Acc_Query(Acc) ; thanks Lexikos - www.autohotkey.com/forum/viewtopic.php?t=81731&p=509530#509530
{static IAccessible:="{618736e0-3c3d-11cf-810c-00aa00389b71}"try return ComObj(9, ComObjQuery(Acc,IAccessible), 1)
}Acc_Role(Acc, ChildId=0)
{try return ComObjType(Acc,"Name")="IAccessible"? Acc_GetRoleText(Acc.accRole(ChildId)):"invalid object"
}Acc_State(Acc, ChildId=0)
{try return ComObjType(Acc,"Name")="IAccessible"? Acc_GetStateText(Acc.accState(ChildId)):"invalid object"
}Acc_GetRoleText(nRole)
{Acc_Init()nSize := DllCall("oleacc\GetRoleText", "Uint", nRole, "Ptr", 0, "Uint", 0)VarSetCapacity(sRole, (A_IsUnicode?2:1)*nSize)DllCall("oleacc\GetRoleText", "Uint", nRole, "str", sRole, "Uint", nSize+1)return sRole
}Acc_GetStateText(nState)
{Acc_Init()nSize := DllCall("oleacc\GetStateText", "Uint", nState, "Ptr", 0, "Uint", 0)VarSetCapacity(sState, (A_IsUnicode?2:1)*nSize)DllCall("oleacc\GetStateText", "Uint", nState, "str", sState, "Uint", nSize+1)return sState
}Acc_Error(p="")
{static setting:=0return p=""?setting:setting:=p
}


http://www.ppmy.cn/news/627761.html

相关文章

基于Qt的仿酷狗音乐播放器设计(一)

简述 其实在很早以前博主就有想用Qt写一个比较好的音乐播放器的想法&#xff0c;但由于平时上课的压力和以前对设计模式和代码规范做的不太好&#xff0c;一直没有进行。所以在这个寒假准备好好的设计一下。下面先简单的说明一下设计的大概。 网络音乐API的获取界面的布局功能…

Flink DataStream之创建执行环境

新建project&#xff1a; pom文件 <?xml version"1.0" encoding"UTF-8"?> <project xmlns"http://maven.apache.org/POM/4.0.0"xmlns:xsi"http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation"http://ma…

微信小程序 :模仿酷狗音乐播放器等界面

也没啥。。。就设计师要求按照他的界面来画。。所以就没办法了 wxml代码&#xff1a; <!--当前为停止状态 --> <view style"width:250rpx;height:250rpx;left:250rpx;top:12rpx;position:relative;" wx:if"{{isplayfalse}}" bindtapplay>&l…

基于动态手势识别的酷狗音乐播放器控制

动态手势识别控制酷狗音乐播放器&#xff0c;2011年第一天放上&#xff0c;算是给大家新年的祝福&#xff0c;新年快乐&#xff01; 操作演示&#xff1a;http://v.youku.com/v_show/id_XMjMzNzQzOTYw.html 这是手机录的像&#xff0c;声音比图像提前了两三秒吧&#xff0c;所…

截获网易云、酷狗、QQ音乐播放器桌面歌词画面心德

在直播项目中 需要捕获某个窗口的画面并共享 总结了如下几种场景中窗口的捕获方法 1、dc拷贝&#xff08;BitBlt、PrintWindow&#xff09; 这是最基本的方法 直接拿到窗口dc 然后从dc中拷贝窗口画面 可优先使用PrintWindow 因为该API可以捕获窗口超出桌面范围的区域。需要注意…

Python爬虫入门系列之Scrapy爬取Ajax网页

Python爬虫入门系列之Scrapy爬取Ajax网页 在前几篇博客中&#xff0c;我们学习了如何使用Scrapy框架爬取静态和动态网页。然而&#xff0c;有些网页使用Ajax技术加载数据&#xff0c;这就需要我们使用特殊的方法来获取这些网页的内容。本篇博客将介绍如何使用Scrapy爬取Ajax网页…

第4讲:使用ajax技术实现菜单展开或隐藏功能(xml数据)

使用ajax技术实现点击菜单时&#xff0c;展开当前子菜单列表&#xff0c;隐藏其他子菜单功能&#xff1b;前端使用静态html页面生成一级菜单&#xff0c;当点击某个菜单时&#xff0c;发送数据到后端(jsp文件)&#xff0c;利用responseXML返回xml格式文件&#xff0c;刷新二级菜…

大一新生应该如何学习C语言,书上代码看不懂理解不了怎么办?

大家好&#xff0c;我是二哥呀&#xff01; 昨天有个读者问我要 C语言的学习路线&#xff0c;他今年刚上大一&#xff0c;书上的代码完全看不懂。 讲真&#xff0c;大一新生&#xff0c;一般都是零基础的纯小白&#xff0c;看不懂书上的代码很正常&#xff0c;除非是小学、初中…

计算机代码大全,电脑运行代码大全

开始菜单中的“运行”是通向程序的快捷途径&#xff0c;输入特定的命令后&#xff0c;即可快速的打开Windows的大部分程序&#xff0c;熟练的运用它&#xff0c;将给我们的操作带来诸多便捷。 开始菜单--运行--CMD--输入指令 下面就是指令 winver 检查Windows版本 wmimgmt.msc …

笔记本电脑win10打开照相机显示灰色相机解决办法

(1&#xff09;WinR打开命令端&#xff0c;输入regedit运行&#xff1b; &#xff08;2&#xff09;进入HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows Media Foundation \ Platform&#xff1b; &#xff08;3&#xff09;新建DWORD(32位)值&#xff08;D&#xff09;…

扑捉和捕捉的区别照相_扑捉和捕捉的区别照相

捕捉与抓拍有什么区别 ______ 捕捉是在对象明确且有时间等待情况下进行的;抓拍是对象不明确且无意中拍到的, 对象捕捉与捕捉模式的重要区别是什么?_ ______ 对象捕捉是AutoCAD中最为重要的工具之一,使用对象捕捉可以精确定位,使用户在绘图过程中可直接利用光标来准确地确定目标…

无人机视角展示(无人机图像定位 )--某数学建模A题MATLAB代码

近期没啥空&#xff0c;水个简单的。。。。 目前只写了第一问&#xff0c;有空再写。。。。。 问题描述 无人驾驶飞机简称“无人机”&#xff0c;是利用无线电遥控设备和自备的程序控制装置操纵的不载人飞机。搭载图像设备的无人机在高空航拍、区域巡视、军事侦查等方面有广泛…

计算机启动进入桌面非常慢,电脑开机快进入桌面慢怎么办

大家都知道电脑使用越久&#xff0c;开机就可能越慢&#xff0c;但也可能出现开机快但进入桌面慢的情况&#xff0c;下面是学习啦小编为大家整理了关于电脑开机快进入桌面慢的解决方法&#xff0c;希望能够帮助到您! 电脑开机快进入桌面慢的解决方法一 选择“控制面板”->”…

基于车牌形状和颜色的车牌定位

车牌识别的学习和车牌定位的实验 车牌识别算法综述基于形状和颜色的车牌定位第一步&#xff1a;去噪&#xff0c;二值化第二步&#xff1a;边缘检测&#xff0c;开运算和闭运算第三步:颜色筛选出车牌区域 车牌矫正字符分割字符识别 车牌识别算法综述 前言&#xff1a;近年来&a…

Android监听照相广播

也许很多时候&#xff0c;你想实现一个功能&#xff0c;那就是&#xff0c;当用手机拍照时&#xff0c;你的程序可以知道已经拍照完成&#xff0c;并取得刚拍摄的照片。这个思路很简单&#xff0c;就是新建一个广播接收器&#xff0c;当手机进行拍照的时候&#xff0c;系统会发…

iOS-AVCapture,自定义实现照相功能

关于iOS调用摄像机来获取照片&#xff0c;通常我们都会调用UIImagePickerController来调用系统提供的相机来拍照&#xff0c;这个控件非常好用。但是有时UIImagePickerController控件无法满足我们的需求&#xff0c;例如我们需要更加复杂的OverlayerView&#xff0c;这时候我们…

精彩案例-悬浮在桌面上的照相机

一、简介 这个案例就是在桌面上开启一个悬浮窗,悬浮窗里实时显示照相机的内容,可以自由拖动,当在非桌面状态下自动隐藏.如下图所示(): PS:gif都失真了,凑合看&#xff0c;实际中这个窗口是不会闪烁的 我做这个是因为公司项目里在android系统的NavigationBar里显示了行车记录仪…

Android_照相机Camera_调用系统照相机返回data为空

本博文为子墨原创&#xff0c;转载请注明出处&#xff01; http://blog.csdn.net/zimo2013/article/details/16916279 1.调用系统照相机 //实例化一个intent&#xff0c;并指定action Intent intent new Intent(MediaStore.ACTION_IMAGE_CAPTURE); //指定一个图片路径对应的fi…

照相物镜的zemax设计

转载公众号小小光 照相物镜的zemax设计 题目 1.一个照相物镜的设计&#xff1a;设计一个照相物镜&#xff0c;焦距f’9mm&#xff0c;F/#为4&#xff0c;视场2w40。具体要求如下&#xff1a; a.所有视场在67.5lp/mm处的调制传递函数MTF>0.3。&#xff08;本题目来自《光学…

图像颜色校正的几种方法

各种教学视频或文档资料 QQ&#xff1a;635992897 注&#xff1a;本文主要参考“彩色人脸图像颜色校正及其在肝病诊断中的应用研究”硕士论文 采集的图片颜色与采集环境有很大关系&#xff0c;同一个样本在不同的采集环境下得到的图片颜色是不一样的&#xff0c;这就影响了样本…
最新文章