@@ -30,8 +30,15 @@ public class Main {
30
30
31
31
public static void main (String [] args ) throws IOException , InterruptedException {
32
32
beginTime = System .currentTimeMillis ();
33
- debug = args .length > 0 && args [0 ].equalsIgnoreCase ("debug" );
34
33
config = new File ("config.yml" );
34
+ if (args .length > 2 && args [0 ].equalsIgnoreCase ("direct" )) {
35
+ String url = args [1 ];
36
+ String path = args [2 ];
37
+ downloadFromUrl (url , path );
38
+ System .out .println ("\n 程序运行结束;总运行时间:" + getFormattedTime (System .currentTimeMillis () - beginTime ));
39
+ System .exit (0 );
40
+ }
41
+ debug = args .length > 0 && args [0 ].equalsIgnoreCase ("debug" );
35
42
setScanner ();
36
43
String id = getNumber ();
37
44
String [] login = login ();
@@ -41,6 +48,7 @@ public static void main(String[] args) throws IOException, InterruptedException
41
48
String [] path = getPath ((String ) specified [1 ]);
42
49
download (details , path );
43
50
System .out .println ("\n 程序运行结束;总运行时间:" + getFormattedTime (System .currentTimeMillis () - beginTime ));
51
+ System .exit (0 );
44
52
}
45
53
46
54
private static void setScanner () throws FileNotFoundException {
@@ -254,6 +262,7 @@ private static Object[] getResolutions(JSONObject info, String[] auth, boolean t
254
262
System .out .println ("\n 正在获取清晰度信息······" );
255
263
String videoUrlTV = "https://api.snm0516.aisee.tv/x/tv/ugc/playurl?avid=" + info .getIntValue ("aid" ) + "&mobi_app=android_tv_yst&fnval=80&qn=120&cid=" + cid + (tv ? "&access_key=" + auth [1 ] : "" ) + "&fourk=1&platform=android&device=android&build=103800&fnver=0" ;
256
264
String videoUrlWeb = "https://api.bilibili.com/x/player/playurl?avid=" + info .getIntValue ("aid" ) + "&cid=" + cid + "&fnval=80&fourk=1" ;
265
+ // String videoUrlWebPGC = "https://api.bilibili.com/pgc/player/web/playurl?cid=" + cid + "&qn=120&fourk=1&fnver=0&fnval=80";
257
266
JSONObject videoTV = HttpManager .readJsonFromUrl (videoUrlTV , "#" , true );
258
267
JSONObject videoWeb = HttpManager .readJsonFromUrl (videoUrlWeb , auth [0 ], false ).getJSONObject ("data" );
259
268
JSONArray qualitiesTV = videoTV .getJSONArray ("accept_description" );
@@ -579,7 +588,7 @@ private static long downloadFromUrl(String address, String path, List<Map.Entry<
579
588
long remainingSizeLen = calcRemainingSize (status );
580
589
int threadAmount = status .size ();
581
590
double remainingSize = remainingSizeLen / 1024.0 / 1024.0 ;
582
- System .out .println ("剩余文件大小 :" + String .format ("%,.3f" , remainingSize ) + (debug ? "MB(" + remainingSizeLen + "B)" : "MB" ));
591
+ System .out .println ("\n 剩余文件大小 :" + String .format ("%,.3f" , remainingSize ) + (debug ? "MB(" + remainingSizeLen + "B)" : "MB" ));
583
592
System .out .println ("下载所用线程数:" + threadAmount );
584
593
System .out .println ("本次是第" + tries + "次重试,若数次下载失败请考虑强制退出程序" );
585
594
long beginTime = System .currentTimeMillis ();
0 commit comments