思路

1.提取https://drive.google.com/drive/folders/**** 链接
2.用批处理得到链接*****部分
3.对gclone生成的结果进行URL编码并喂到idm
4.清理临时的URL编码脚本UrlEncode.vbs

脚本

脚本内有三处需要手动修改,因为每个人的账号不同。 但是没必要每次都输入,算是写死了。

1.gclone项目的名称,打开gclone config file 找到路径,打开第一行[]
2.IDM路径
3.GDindex域名, 需要精确到https://......./

@echo off
chcp 65001
cls
set /p "url=url:"
set /p "p=path:"
for /f "tokens=1,2,3,5 delims=/?=&" %%i in ("%url%") do (set "a=%%l")
for /f "tokens=1 delims=:" %%a in ('findstr /n "^::CreatUrlEncode::$" "%~f0"') do more +%%a "%~f0">UrlEncode.vbs
for /f "tokens=2 delims= " %%a in ('gclone ls <Gclone项目名称>:{%a%}') do (
for /f "delims=" %%i in ('cscript  /nologo UrlEncode.vbs "%%~a"') do cmd /c <IDM路径>IDMan.exe -d "https://GDindex域名/%%~i?rootId=%a%" -n -a -p %p% )
del /f /q UrlEncode.vbs
exit

::CreatUrlEncode::
'UrlEncode By Demon
Function UrlEncode(str)
Dim i,c,s,length
length = Len(str)
For i = 1 To length
s = Mid(str,i,1)
c = "&H" & Hex(AscW(Mid(str,i,1)))
If ( c >= AscW("A") And c <= AscW("Z") ) Or _
( c >= AscW("a") And c <= AscW("z") ) Or _
( c >= AscW("0") And c <= AscW("9") ) Or _
( c = AscW("-") Or c = AscW("_") Or c = AscW(".") ) Or _
( c = Asc(":") Or c = Asc("/") ) Then
UrlEncode = UrlEncode & s
ElseIf c = AscW(" ") Then
UrlEncode = UrlEncode & "+"
Else
If c >= &H0001 And c <= &H007F Then
UrlEncode = UrlEncode & s
ElseIf c > &H07FF Then
UrlEncode = UrlEncode & "%" & Hex(&HE0 Or (c\(2^12) And &H0F))
UrlEncode = UrlEncode & "%" & Hex(&H80 Or (c\(2^6) And &H3F))
UrlEncode = UrlEncode & "%" & Hex(&H80 Or (c\(2^0) And &H3F))
Else
UrlEncode = UrlEncode & "%" & Hex(&HC0 Or (c\(2^6) And &H1F))
UrlEncode = UrlEncode & "%" & Hex(&H80 Or (c\(2^0) And &H3F))
End If
End If
Next
End Function
WScript.Echo UrlEncode(WScript.Arguments(0))

另辟蹊径

在控制台输入: urls = $$('a'); for (url in urls) console.log ( urls[url].href );

如果链接长的话 中间部分可能会以...来代替, firefox暂时找不到方法来避免这个问题.. 但是edge可以完美展示,复制下来然后简单处理一下 就可以批量下载了。

经过我的更新维护,这个脚本越来越强了,我自己觉得很好用