看到这个 豆瓣FM API 的资料
忍不住想用AHK写一个,豆瓣的客户端我已经受够了。。。
可惜的是,完全不会网页操作这部分啊,求助啊,临时~~~
https://github.com/zonyitoo/doubanfm-qt ... 3%A3FM-API
正在尝试中。。。
求助 关于豆瓣电台的API
Moderators: tmplinshi, arcticir
Re: 求助 关于豆瓣电台的API
找个似乎差不多的代码,修改中。。。
Code: Select all
;Prepare our WinHttpRequest object
HttpObj := ComObjCreate("WinHttp.WinHttpRequest.5.1")
;HttpObj.SetProxy(2,"localhost:8888") ;Send data through Fiddler
HttpObj.SetTimeouts(6000,6000,6000,6000) ;Set timeouts to 6 seconds
;HttpObj.Option(6) := False ;disable location-header rediects
;Set our URLs
loginSiteURL := "http://www.autohotkey.com/board/index.php?app=core&module=global§ion=login"
loginURL := "http://www.autohotkey.com/board/index.php?app=core&module=global§ion=login&do=process"
;Set our login data
username := "Brutosozialprodukt"
password := "xxxxxxxxxxxxxx"
rememberMe := "1"
;Step 1
HttpObj.Open("GET",loginSiteURL)
HttpObj.Send()
;Step 2
RegExMatch(HttpObj.ResponseText,"<input\stype='hidden'\sname='auth_key'\svalue='(\w+)'\s/>",match)
auth_key := match1
;Step 3
loginBody := "auth_key=" auth_key "&ips_username=" username "&ips_password=" password "&rememberMe=" rememberMe
;Step 4/5
HttpObj.Open("POST",loginURL)
HttpObj.SetRequestHeader("Content-Type","application/x-www-form-urlencoded")
HttpObj.Send(loginBody)
;Step 6
If (InStr(HttpObj.ResponseText,"<title>Sign In"))
MsgBox, The login failed!
Else
MsgBox, Login was successfull!
Re: 求助 关于豆瓣电台的API
丫的不按套路来啊
这个咋两个地址?
豆瓣只给一个
这个咋两个地址?
Code: Select all
loginSiteURL := "http://www.autohotkey.com/board/index.php?app=core&module=global§ion=login"
loginURL := "http://www.autohotkey.com/board/index.php?app=core&module=global§ion=login&do=process"
Code: Select all
URL: http://www.douban.com/j/app/login
Re: 求助 关于豆瓣电台的API
成功了
登陆接口完成。
登陆接口完成。
Code: Select all
;Prepare our WinHttpRequest object
HttpObj := ComObjCreate("WinHttp.WinHttpRequest.5.1")
;HttpObj.SetProxy(2,"localhost:8888") ;Send data through Fiddler
HttpObj.SetTimeouts(6000,6000,6000,6000) ;Set timeouts to 6 seconds
;HttpObj.Option(6) := False ;disable location-header rediects
;Set our URLs
loginURL := "http://www.douban.com/j/app/login"
;Set our login data
email := "kongqir@gmail.com"
password := "kongqir"
;Step 1
loginBody := "email=" email "&password=" password "&app_name=radio_desktop_win&version=100"
;Step 2/3
HttpObj.Open("POST",loginURL)
HttpObj.SetRequestHeader("Content-Type","application/x-www-form-urlencoded")
HttpObj.Send(loginBody)
MsgBox % HttpObj.ResponseText
;Step 4
If (InStr(HttpObj.ResponseText,"<title>Login"))
MsgBox, The login failed!
Else
MsgBox, Login was successfull!
Re: 求助 关于豆瓣电台的API
获取频道列表完成。
MsgBox % Z_Com("http://www.douban.com/j/app/radio/channels")
Z_Com(h:="http://61.135.169.125/forbiddenip/forbidden.html", c:="", p:=""){
comobjerror(false),x := comobjcreate("winhttp.winhttprequest.5.1"),(p?x.setproxy(2, p):""),x.open("get",h,true)
,x.setrequestheader("user-agent", "mozilla/5.0 (windows nt 5.1; rv:11.0) gecko/20100101 firefox/11.0"), x.send(), x.WaitForResponse(-1)
if c {
s:=comobjcreate("adodb.stream"), s.type := 1, s.mode := 3, s.open(), s.write(x.responsebody), s.position := 0, s.type := 2, s.charset := c
return s.readtext(),s.close()
}
else return x.responsetext
}
MsgBox % Z_Com("http://www.douban.com/j/app/radio/channels")
Z_Com(h:="http://61.135.169.125/forbiddenip/forbidden.html", c:="", p:=""){
comobjerror(false),x := comobjcreate("winhttp.winhttprequest.5.1"),(p?x.setproxy(2, p):""),x.open("get",h,true)
,x.setrequestheader("user-agent", "mozilla/5.0 (windows nt 5.1; rv:11.0) gecko/20100101 firefox/11.0"), x.send(), x.WaitForResponse(-1)
if c {
s:=comobjcreate("adodb.stream"), s.type := 1, s.mode := 3, s.open(), s.write(x.responsebody), s.position := 0, s.type := 2, s.charset := c
return s.readtext(),s.close()
}
else return x.responsetext
}
Re: 求助 关于豆瓣电台的API
难道又换套路了,无法获取歌曲列表,提示说 version 错误
Code: Select all
;Prepare our WinHttpRequest object
HttpObj := ComObjCreate("WinHttp.WinHttpRequest.5.1")
;HttpObj.SetProxy(2,"localhost:8888") ;Send data through Fiddler
HttpObj.SetTimeouts(6000,6000,6000,6000) ;Set timeouts to 6 seconds
;HttpObj.Option(6) := False ;disable location-header rediects
;Set our URLs
loginURL := "http://www.douban.com/j/app/radio/people"
;Step 1
loginBody := "app_name=radio_desktop_win&version=100&type=p"
;Step 2/3
HttpObj.Open("GET",loginURL)
HttpObj.Send(loginBody)
MsgBox % HttpObj.ResponseText
Re: 求助 关于豆瓣电台的API
临时帮我解决了最后一步。再无障碍。
Code: Select all
MsgBox % Z_Com("http://www.douban.com/j/app/radio/people?app_name=radio_desktop_win&version=100&type=n&channel=1")
Re: 求助 关于豆瓣电台的API
完成会在展示区发布的。
接下来就是GUI了。
我打算写个类似安卓通知中心一样的伸缩栏
用于控制这些模块。
不过有些困难啊,功能倒好实现,就是写不美观。。。丑是原罪啊
接下来就是GUI了。
我打算写个类似安卓通知中心一样的伸缩栏
用于控制这些模块。
不过有些困难啊,功能倒好实现,就是写不美观。。。丑是原罪啊
Who is online
Users browsing this forum: No registered users and 15 guests