更新文件: getwebdavlist.exe, webdav_simulator.arm64, getalist.exe, getwebdavlist.py, webdav_simulator.amd64 等13个文件
This commit is contained in:
BIN
get115list.exe
BIN
get115list.exe
Binary file not shown.
@ -7,12 +7,25 @@ import time
|
|||||||
import traceback
|
import traceback
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
|
import traceback
|
||||||
|
|
||||||
count=0
|
count=0
|
||||||
|
failcount=0
|
||||||
|
|
||||||
|
fullscan=True
|
||||||
|
|
||||||
def walk_dir(fs,f,replaceroot):
|
def walk_dir(fs,f,replaceroot):
|
||||||
dirlist=list()
|
dirlist=list()
|
||||||
file_list = fs.listdir_attr()
|
try:
|
||||||
|
file_list = fs.listdir_attr()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("get ctrl+c, exit")
|
||||||
|
sys.exit(1)
|
||||||
|
except:
|
||||||
|
traceback.print_exc()
|
||||||
|
time.sleep(1)
|
||||||
|
return
|
||||||
filetype_re=re.compile(r'\.(png|jpg|jpeg|bmp|gif|doc|nfo|flac|mp3|wma|ape|cue|wav|dst|dff|dts|ac3|eac3|txt)$')
|
filetype_re=re.compile(r'\.(png|jpg|jpeg|bmp|gif|doc|nfo|flac|mp3|wma|ape|cue|wav|dst|dff|dts|ac3|eac3|txt)$')
|
||||||
for file_obj in file_list:
|
for file_obj in file_list:
|
||||||
if not file_obj.is_directory:
|
if not file_obj.is_directory:
|
||||||
@ -31,11 +44,18 @@ def walk_dir(fs,f,replaceroot):
|
|||||||
dirlist.append(file_obj.path)
|
dirlist.append(file_obj.path)
|
||||||
for dirItem in dirlist:
|
for dirItem in dirlist:
|
||||||
fs.chdir(dirItem)
|
fs.chdir(dirItem)
|
||||||
# global count
|
global count
|
||||||
# count=count+1
|
count=count+1
|
||||||
# if count%4==0:
|
if count%3==0:
|
||||||
# time.sleep(1)
|
time.sleep(1)
|
||||||
walk_dir(fs,f,replaceroot)
|
try:
|
||||||
|
walk_dir(fs,f,replaceroot)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("get ctrl+c, exit")
|
||||||
|
sys.exit(1)
|
||||||
|
except:
|
||||||
|
traceback.print_exc()
|
||||||
|
time.sleep(1)
|
||||||
return
|
return
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -53,8 +73,19 @@ def main():
|
|||||||
shareUrl = "https://115.com/s/" + shareUrl
|
shareUrl = "https://115.com/s/" + shareUrl
|
||||||
|
|
||||||
print("cookie:"+args.cookie+", shareurl:"+shareUrl)
|
print("cookie:"+args.cookie+", shareurl:"+shareUrl)
|
||||||
|
cidre = re.compile(r'cid=([0-9]+)')
|
||||||
|
matches = cidre.findall(shareUrl)
|
||||||
|
cid = None
|
||||||
|
if len(matches)>0:
|
||||||
|
cid=int(matches[0])
|
||||||
|
shareUrl = cidre.sub("", shareUrl).replace("?&","?").replace("&&","&")
|
||||||
|
|
||||||
fs = client.get_share_fs(shareUrl)
|
fs = client.get_share_fs(shareUrl)
|
||||||
|
|
||||||
|
#if cid != None:
|
||||||
|
# fs.chdir(cid)
|
||||||
|
|
||||||
|
|
||||||
count=0
|
count=0
|
||||||
f=open(args.output, mode="a", encoding="utf-8")
|
f=open(args.output, mode="a", encoding="utf-8")
|
||||||
walk_dir(fs,f,args.replaceroot)
|
walk_dir(fs,f,args.replaceroot)
|
||||||
|
BIN
getalist.exe
Normal file
BIN
getalist.exe
Normal file
Binary file not shown.
173
getalist.py
Normal file
173
getalist.py
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf- -*-
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
import re
|
||||||
|
import requests
|
||||||
|
import traceback
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
count=0
|
||||||
|
|
||||||
|
failcount=0
|
||||||
|
|
||||||
|
fullscan=True
|
||||||
|
|
||||||
|
def walk(headers:dict, api_url:str, current_path="/", output_file=None, replaceroot=None, lastpath=None):
|
||||||
|
params = {"path": current_path}
|
||||||
|
#print(f"params:{params}")
|
||||||
|
try:
|
||||||
|
resp = requests.post(
|
||||||
|
api_url+"/api/fs/list",
|
||||||
|
headers=headers,
|
||||||
|
json=params,
|
||||||
|
stream=True,
|
||||||
|
timeout=(5,15),
|
||||||
|
)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("get ctrl+c, exit")
|
||||||
|
sys.exit(1)
|
||||||
|
except:
|
||||||
|
traceback.print_exc()
|
||||||
|
print(f"request fail to server:{api_url}")
|
||||||
|
time.sleep(1)
|
||||||
|
#sys.exit(1)
|
||||||
|
return
|
||||||
|
resp.raise_for_status()
|
||||||
|
body = resp.content.decode('utf-8')
|
||||||
|
resp.close()
|
||||||
|
# 解析 JSON 数据
|
||||||
|
data_dict = json.loads(body)
|
||||||
|
|
||||||
|
# 获取 raw_url
|
||||||
|
global failcount
|
||||||
|
try:
|
||||||
|
items = data_dict['data']['content']
|
||||||
|
failcount=0
|
||||||
|
except:
|
||||||
|
traceback.print_exc()
|
||||||
|
time.sleep(1)
|
||||||
|
#sys.exit(1)
|
||||||
|
failcount += 1
|
||||||
|
if failcount>10:
|
||||||
|
sys.exit(1)
|
||||||
|
return
|
||||||
|
|
||||||
|
print(f"contentlist len:{len(items)}")
|
||||||
|
# items=client.list(current_path)
|
||||||
|
|
||||||
|
filetype_re=re.compile(r'\.(png|jpg|jpeg|bmp|gif|doc|nfo|flac|mp3|wma|ape|cue|wav|dst|dff|dts|ac3|eac3|txt)$')
|
||||||
|
# print(items)
|
||||||
|
for item in items:
|
||||||
|
full_path = f"{current_path}/{item['name']}".replace("//", "/")
|
||||||
|
try:
|
||||||
|
# is_dir = client.is_dir(full_path)
|
||||||
|
# is_dir = full_path.endswith("/")
|
||||||
|
is_dir = item["is_dir"]
|
||||||
|
except:
|
||||||
|
continue
|
||||||
|
global fullscan
|
||||||
|
# print(f"fullscan:{fullscan}, full_path:{full_path}, lastpath:{lastpath}")
|
||||||
|
if is_dir: # 判断是否为目录
|
||||||
|
global count
|
||||||
|
count=count+1
|
||||||
|
if fullscan:
|
||||||
|
if count%3==0:
|
||||||
|
time.sleep(1)
|
||||||
|
#else:
|
||||||
|
# if count%10==0:
|
||||||
|
# time.sleep(1)
|
||||||
|
if not fullscan and not full_path in lastpath:
|
||||||
|
print(f"not fullscan and full_path:{full_path} not in lastpath:{lastpath}, skip")
|
||||||
|
continue
|
||||||
|
if full_path == lastpath:
|
||||||
|
print(f"found full_path:{full_path} equal lastpath:{lastpath}, enter fullscan mode")
|
||||||
|
time.sleep(3)
|
||||||
|
fullscan = True
|
||||||
|
try:
|
||||||
|
walk(headers, api_url, full_path, output_file, replaceroot, lastpath)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("get ctrl+c, exit")
|
||||||
|
sys.exit(1)
|
||||||
|
except:
|
||||||
|
traceback.print_exc()
|
||||||
|
#sys.exit(1)
|
||||||
|
pass
|
||||||
|
elif not fullscan:
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
if filetype_re.search(full_path) != None or "BDMV" in full_path:
|
||||||
|
continue
|
||||||
|
# size = client.info(full_path).get('size', 0)
|
||||||
|
size = item["size"]
|
||||||
|
if replaceroot!=None:
|
||||||
|
if replaceroot=="":
|
||||||
|
full_path=os.path.join("/",*full_path.split("/")[2:])
|
||||||
|
else:
|
||||||
|
full_path=os.path.join("/",replaceroot,*full_path.split("/")[2:])
|
||||||
|
print(f"{full_path}\t{size}")
|
||||||
|
if output_file != None:
|
||||||
|
output_file.write(f"{full_path}\t{size}\n")
|
||||||
|
output_file.flush()
|
||||||
|
|
||||||
|
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
def extract_url_components(url):
|
||||||
|
"""分解 URL 为 schema(协议)、hostname(主机地址)、path(路径)"""
|
||||||
|
parsed = urlparse(url)
|
||||||
|
|
||||||
|
# 提取核心组件
|
||||||
|
schema = parsed.scheme or "http" # 默认协议处理
|
||||||
|
hostname = f"{parsed.hostname}:{parsed.port}" # 自动过滤端口和认证信息
|
||||||
|
path = parsed.path.rstrip('/') or '/' # 路径标准化
|
||||||
|
|
||||||
|
return schema, hostname, path
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description='快速遍历AList目录')
|
||||||
|
parser.add_argument('--url', type=str, required=True, help='AList URL')
|
||||||
|
parser.add_argument('--token', type=str, default=None, required=False, help='AList token')
|
||||||
|
parser.add_argument('--output', type=str, required=True, help='输出文件')
|
||||||
|
parser.add_argument('--lastpath', type=str, default=None, required=False, help='最后扫到的路径(从此开始继续)')
|
||||||
|
parser.add_argument('--replaceroot', type=str, default=None, required=False, help='替换根目录名称')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
schema, hostname, path = extract_url_components(args.url)
|
||||||
|
print(schema,hostname,path)
|
||||||
|
|
||||||
|
print("AList URL:", args.url)
|
||||||
|
if args.lastpath == None:
|
||||||
|
try:
|
||||||
|
with open(args.output, "r", encoding="utf-8") as f:
|
||||||
|
tmplines = f.readlines()
|
||||||
|
for i in range(len(tmplines)-1, -1, -1):
|
||||||
|
line=tmplines[i].strip()
|
||||||
|
if line != None and line != "":
|
||||||
|
args.lastpath = os.path.dirname(line.split("\t")[0])
|
||||||
|
break
|
||||||
|
except:
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
|
output_file = open(args.output, mode="a", encoding="utf-8")
|
||||||
|
if args.lastpath != None and args.lastpath != "":
|
||||||
|
global fullscan
|
||||||
|
fullscan = False
|
||||||
|
if args.lastpath != None:
|
||||||
|
args.lastpath=args.lastpath.rstrip('/')
|
||||||
|
print(f"lastpath:{args.lastpath}")
|
||||||
|
headers = {
|
||||||
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
}
|
||||||
|
if args.token != None and args.token != "":
|
||||||
|
headers["Authorization"] = args.token
|
||||||
|
walk(headers, schema+"://"+hostname, path, output_file,args.replaceroot, args.lastpath)
|
||||||
|
output_file.close()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
Binary file not shown.
@ -6,11 +6,29 @@ from webdav3.client import Client
|
|||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
|
import traceback
|
||||||
|
|
||||||
count=0
|
count=0
|
||||||
|
failcount=0
|
||||||
|
|
||||||
def walk(client, current_path="/", output_file=None, replaceroot=None):
|
fullscan=True
|
||||||
items=client.list(current_path)
|
|
||||||
|
def walk(client, current_path="/", output_file=None, replaceroot=None, lastpath=None):
|
||||||
|
global failcount
|
||||||
|
try:
|
||||||
|
items=client.list(current_path)
|
||||||
|
failcount=0
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("get ctrl+c, exit")
|
||||||
|
sys.exit(1)
|
||||||
|
except:
|
||||||
|
traceback.print_exc()
|
||||||
|
time.sleep(1)
|
||||||
|
failcount+=1
|
||||||
|
if failcount>10:
|
||||||
|
sys.exit(1)
|
||||||
|
return
|
||||||
filetype_re=re.compile(r'\.(png|jpg|jpeg|bmp|gif|doc|nfo|flac|mp3|wma|ape|cue|wav|dst|dff|dts|ac3|eac3|txt)$')
|
filetype_re=re.compile(r'\.(png|jpg|jpeg|bmp|gif|doc|nfo|flac|mp3|wma|ape|cue|wav|dst|dff|dts|ac3|eac3|txt)$')
|
||||||
# print(items)
|
# print(items)
|
||||||
for item in items[1:]:
|
for item in items[1:]:
|
||||||
@ -20,15 +38,28 @@ def walk(client, current_path="/", output_file=None, replaceroot=None):
|
|||||||
is_dir = full_path.endswith("/")
|
is_dir = full_path.endswith("/")
|
||||||
except:
|
except:
|
||||||
continue
|
continue
|
||||||
|
global fullscan
|
||||||
|
# print(f"fullscan:{fullscan}, full_path:{full_path}, lastpath:{lastpath}")
|
||||||
if is_dir: # 判断是否为目录
|
if is_dir: # 判断是否为目录
|
||||||
#global count
|
#global count
|
||||||
#count=count+1
|
#count=count+1
|
||||||
#if count%4==0:
|
#if count%4==0:
|
||||||
# time.sleep(1)
|
# time.sleep(1)
|
||||||
|
if not fullscan and not full_path in lastpath:
|
||||||
|
continue
|
||||||
|
if full_path == lastpath:
|
||||||
|
fullscan = True
|
||||||
try:
|
try:
|
||||||
walk(client, full_path, output_file, replaceroot)
|
walk(client, full_path, output_file, replaceroot, lastpath)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("get ctrl+c, exit")
|
||||||
|
sys.exit(1)
|
||||||
except:
|
except:
|
||||||
|
time.sleep(1)
|
||||||
|
#sys.exit(1)
|
||||||
pass
|
pass
|
||||||
|
elif not fullscan:
|
||||||
|
continue
|
||||||
else:
|
else:
|
||||||
if filetype_re.search(full_path) != None or "BDMV" in full_path:
|
if filetype_re.search(full_path) != None or "BDMV" in full_path:
|
||||||
continue
|
continue
|
||||||
@ -41,6 +72,7 @@ def walk(client, current_path="/", output_file=None, replaceroot=None):
|
|||||||
print(f"{full_path}\t{size}")
|
print(f"{full_path}\t{size}")
|
||||||
if output_file != None:
|
if output_file != None:
|
||||||
output_file.write(f"{full_path}\t{size}\n")
|
output_file.write(f"{full_path}\t{size}\n")
|
||||||
|
output_file.flush()
|
||||||
|
|
||||||
|
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
@ -62,7 +94,8 @@ def main():
|
|||||||
parser.add_argument('--url', type=str, required=True, help='WebDAV URL')
|
parser.add_argument('--url', type=str, required=True, help='WebDAV URL')
|
||||||
parser.add_argument('--username', type=str, required=True, help='WebDAV username')
|
parser.add_argument('--username', type=str, required=True, help='WebDAV username')
|
||||||
parser.add_argument('--password', type=str, required=True, help='WebDAV password')
|
parser.add_argument('--password', type=str, required=True, help='WebDAV password')
|
||||||
parser.add_argument('--output', type=str, required=True, help='outputfile')
|
parser.add_argument('--output', type=str, required=True, help='输出文件')
|
||||||
|
parser.add_argument('--lastpath', type=str, default=None, required=False, help='最后扫到的路径(从此开始继续)')
|
||||||
parser.add_argument('--replaceroot', type=str, default=None, required=False, help='替换根目录名称')
|
parser.add_argument('--replaceroot', type=str, default=None, required=False, help='替换根目录名称')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
@ -80,8 +113,26 @@ def main():
|
|||||||
client = Client(options)
|
client = Client(options)
|
||||||
|
|
||||||
print("WebDAV URL:", args.url)
|
print("WebDAV URL:", args.url)
|
||||||
|
if args.lastpath == None:
|
||||||
|
try:
|
||||||
|
with open(args.output, "r", encoding="utf-8") as f:
|
||||||
|
tmplines = f.readlines()
|
||||||
|
for i in range(len(tmplines)-1, -1, -1):
|
||||||
|
line=tmplines[i].strip()
|
||||||
|
if line != None and line != "":
|
||||||
|
args.lastpath = os.path.dirname(line.split("\t")[0])
|
||||||
|
break
|
||||||
|
except:
|
||||||
|
traceback.print_exc()
|
||||||
output_file = open(args.output, mode="a", encoding="utf-8")
|
output_file = open(args.output, mode="a", encoding="utf-8")
|
||||||
walk(client, path, output_file,args.replaceroot)
|
if args.lastpath != None and args.lastpath != "":
|
||||||
|
global fullscan
|
||||||
|
fullscan = False
|
||||||
|
if args.lastpath != None:
|
||||||
|
if not args.lastpath.endswith("/"):
|
||||||
|
args.lastpath = args.lastpath+"/"
|
||||||
|
print(f"lastpath:{args.lastpath}")
|
||||||
|
walk(client, path, output_file,args.replaceroot, args.lastpath)
|
||||||
output_file.close()
|
output_file.close()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
2
run.bat
2
run.bat
@ -1,3 +1,3 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
webdav_simulator.exe --alist_config "http://192.168.1.2:5678/,,#http://192.168.1.3:5678,alist-1234-5678," "xy115-all.txt.xz#xy.txt.xz"
|
webdav_simulator.exe --alist_config "http://192.168.1.2:5678/,,#http://192.168.1.3:5678,alist-1234-5678," "xy115-all.txt.xz#xy-dy.txt.xz"
|
||||||
|
2
run.sh
2
run.sh
@ -18,4 +18,4 @@ cd "${progdir}"
|
|||||||
mkdir tmp
|
mkdir tmp
|
||||||
chmod 777 tmp
|
chmod 777 tmp
|
||||||
export TMPDIR=tmp
|
export TMPDIR=tmp
|
||||||
./webdav_simulator.amd64 --alist_config "http://192.168.1.2:5678,,#http://192.168.1.3:5678,alist-1234-5678," "xy115-all.txt.xz#xy.txt.xz"
|
./webdav_simulator.amd64 --alist_config "http://192.168.1.2:5678,,#http://192.168.1.3:5678,alist-1234-5678," "xy115-all.txt.xz#xy-dy.txt.xz"
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
xy-dailynew.txt.xz
Normal file
BIN
xy-dailynew.txt.xz
Normal file
Binary file not shown.
BIN
xy-dy.txt.xz
Normal file
BIN
xy-dy.txt.xz
Normal file
Binary file not shown.
Reference in New Issue
Block a user