• 新浪微博:
  • 微信 :
按键精灵电脑版
立即下载

软件版本:2014.05
软件大小:21.6M
更新时间:07-04

按键精灵安卓版
立即下载

软件版本:3.3.5
软件大小:62.5M
更新时间:9-25

按键精灵iOS版
立即下载

软件版本:1.3.5
软件大小:29.2M
更新时间:06-14

最新企业版UiBot
立即下载

软件版本:3.3
软件大小:282M
更新时间:08-06

快捷导航

登录 后使用快捷导航
没有帐号? 注册

登录 注册
返回列表 12345678» / 9
发新话题 回复该主题

[分享源码] 【VBS百度云盘资源下载】包含百度post登陆,云盘文件列表,文件... [复制链接]

1#
本帖最后由 qq805101201 于 2015-8-2 17:12 编辑

老规矩,回复看帖!低调使用
  1. '正则提取
  2. Function getRegex(patrn, strng)
  3. Dim regEx, Match, Matches' 创建变量。
  4. Set regEx = New RegExp' 创建正则表达式。
  5. regEx.Pattern = patrn' 设置模式。
  6. regEx.IgnoreCase = True' 设置为不区分大小写。
  7. Set Matches = regEx.Execute(strng)' 执行搜索。
  8. For Each Match In Matches' 对 Matches 集合进行迭代。
  9. RetStr = Match.Value
  10. Next
  11. getRegex = RetStr
  12. End Function
  13. '正则测试
  14. Function getTest(patrn, strng)
  15. Dim regEx, Match, Matches' 创建变量。
  16. Set regEx = New RegExp' 创建正则表达式。
  17. regEx.Pattern = patrn' 设置模式。
  18. regEx.IgnoreCase = True' 设置为不区分大小写。
  19. getTest = regEx.test(strng)
  20. End Function
  21. '调用js执行器方法转义字符
  22. Function encodeURI(code)
  23. set oJS = CreateObject("MSScriptControl.ScriptControl")
  24. oJS.Language="javascript"
  25. encodeURI = oJS.Eval("encodeURIComponent('" + code + "')")
  26. End Function
  27. '登陆,并获取cookie
  28. '这一步搞定,百度什么东西都可以搞定了,签到,云盘登陆,解析……
  29. Function login(usrname, password)
  30. Dim ret, http, cookie, baiduid, txt, isPhone, data, buss, user_agent, baidu_login, baidu_login2, referer, token
  31. user_agent = "Mozilla/4.0 (compatible; SIE 8.0; Windows NT 5.1; Trident/4.0)"
  32. baidu_login = "http://passport.baidu.com/v2/api/?getapi&class=login&tpl=mn&tangram=true"
  33. baidu_login2 = "http://passport.baidu.com/v2/api/?login"
  34. referer = "http://www.baidu.com/cache/user/html/login-1.2.html"
  35. '获取登陆前cookie
  36. Set http = CreateObject("winHttp.winhttpRequest.5.1")
  37. http.open "GET", baidu_login, False
  38. http.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36"
  39. http.setRequestHeader "Referer", referer
  40. http.Send
  41. http.waitForResponse
  42. cookie = http.getallresponseheaders
  43. baiduid = getRegex("(BAIDUID[^;]+)", cookie)
  44. '获取登陆token
  45. Set http = CreateObject("winHttp.winhttpRequest.5.1")
  46. http.open "GET", baidu_login, False
  47. http.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36"
  48. http.setRequestHeader "Referer", referer
  49. http.setRequestHeader "Cookie", baiduid
  50. http.Send
  51. txt = http.ResponseText
  52. txt = getRegex("login_token='([^']+)", txt)
  53. // TracePrint txt
  54. token = Right(txt,len(txt)-13)
  55. // TracePrint token
  56. '是否以电话登陆
  57. isPhone = "false"
  58. ret = getTest("^[1]([3][0-9]{1}|59|58|88|89)[0-9]{8}[ DISCUZ_CODE_0 ]quot;, usrname)
  59. If ret Then
  60. isPhone = "true"
  61. End If
  62. '消息体
  63. data = "username=" & encodeURI(usrname) & "&password=" & encodeURI(password) & "&token=" & token & "&charset=utf-8&index=0&isPhone=" & isPhone & "&mem_pass=on&loginType=1&safeflg=0&staticpage=http%3A%2F%2Fwww.baidu.com%2Fcache%2Fuser%2Fhtml%2Fjump.html&tpl=mn&codestring=&verifycode="
  64. // TracePrint data
  65. Set http = CreateObject("winHttp.winhttpRequest.5.1")
  66. http.open "POST", baidu_login2, False
  67. http.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36"
  68. http.setRequestHeader "Referer", referer
  69. http.setRequestHeader "Cookie", baiduid
  70. http.setRequestHeader "Content-Length", Len(data)
  71. http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  72. http.Send data
  73. http.waitForResponse
  74. cookie = http.getallresponseheaders
  75. // TracePrint cookie
  76. buss = getRegex("(BDUSS[^;]+)", cookie)
  77. login = baiduid & "; " & buss & "; " & txt
  78. End Function
  79. '获取云盘目录列表,用于获取下载的文件路径(download的path参数)
  80. 'cookie:登陆后的cookie
  81. 'path:要访问的文件路径,必须encode的,必须是目录,默认是“/”
  82. Function getYunList(cookie, path)
  83. Dim http, baidu_list, txt
  84. baidu_list = "http://pan.baidu.com/api/list?channel=chunlei&clienttype=0&web=1&num=100&page=1&dir=" & path
  85. Set http = CreateObject("winHttp.winhttpRequest.5.1")
  86. http.open "GET", baidu_list, False
  87. http.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36"
  88. http.setRequestHeader "Cookie", cookie
  89. http.send
  90. getYunList = http.ResponseText
  91. End Function
  92. '云盘资源下载
  93. 'cookie:登陆后的cookie
  94. 'path:要下载的文件路径
  95. 'filepath:文件保存路径,必须encode的
  96. Sub download(cookie, path, filepath)
  97. Dim http, baidu_list, txt, token, adb
  98. token = getRegex("login_token='([^']+)", cookie)
  99. token = Right(token, len(token) - 13)
  100. baidu_list = "http://d.pcs.baidu.com/rest/2.0/pcs/file?app_id=250528&method=download&ec=1&path=" & path & "&ver=2.0&dtype=1&logid=" & token
  101. Set http = CreateObject("winHttp.winhttpRequest.5.1")
  102. http.open "GET", baidu_list, False
  103. http.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36"
  104. http.setRequestHeader "Cookie", cookie
  105. http.send
  106. Set adb = createObject("ADODB.Stream")
  107. adb.Mode=3'模式为读写
  108. adb.Type=1
  109. adb.Open
  110. adb.Write http.ResponseBody
  111. '这里写保存的路径和名字,后缀名要跟你文件后缀名一样哦。2的意思是已有则覆盖之
  112. adb.SaveToFile filepath, 2
  113. Set adb = nothing
  114. Set http = nothing
  115. End Sub
  116. Dim cookie
  117. '登陆百度
  118. cookie = login("百度用户名", "百度密码")
  119. TracePrint cookie
  120. '获取文件列表
  121. str = getYunList(cookie, "/")
  122. TracePrint str
  123. '文件下载
  124. Call download(cookie, "%2F%E6%88%91%E7%9A%84%E8%A7%86%E9%A2%91%2FPreservation.2014.1080p.BluRay.x264.DTS-HD.MA.5.1-RARBG%2FPreservation.2014.1080p.BluRay.x264.DTS-HD.MA.5.1-RARBG.mkv", "d:/aaa.mkv")
复制代码
百度云下载_201582174.rar (, 下载次数:201)


下载path参数即你在网站上看见的path=后面的值。或者[backcolor=rgb(247, 247, 247)]getYunList里面的每个文件的path。


    已有3评分我要评分查看所有评分

    2#

    VBS百度云盘资源下载】包含百度post登陆,云盘文件列表,文件下载修改

    3#

    该用户帖子内容已被屏蔽

    4#

    看看源码

    5#

    XUEXI学习学习

    6#

    太给力了

    7#

    啦啦啦啦啦啦

    8#

    看看,谢谢

    9#


    10#

    kk看看看看

    11#

    给力

    12#


    13#

    有点意思

    14#

    墨迹来咯摸摸哦哦弄

    15#

    支持,我看看

    16#

    aaaaaaaaaaa

    17#

    回复看

    18#

    正好需要这个哦

    19#

    1024

    20#

    看看。。。。。。。。。

    发新话题 回复该主题