mirror of
https://github.com/Eyre-S/Coeur-Morny-Cono.git
synced 2024-11-24 12:07:39 +08:00
添加 BiliTool 的 javadoc
This commit is contained in:
parent
3ec69df9b8
commit
1cadb3b05f
@ -6,5 +6,5 @@ package cc.sukazyo.cono.morny;
|
|||||||
public class GradleProjectConfigures {
|
public class GradleProjectConfigures {
|
||||||
public static final String VERSION = "0.8.0.8";
|
public static final String VERSION = "0.8.0.8";
|
||||||
public static final String CODENAME = "putian";
|
public static final String CODENAME = "putian";
|
||||||
public static final long COMPILE_TIMESTAMP = 1666028272898L;
|
public static final long COMPILE_TIMESTAMP = 1666081630449L;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,23 @@ public class BiliTool {
|
|||||||
private static final char[] BV_TEMPLATE = "1 4 1 7 ".toCharArray();
|
private static final char[] BV_TEMPLATE = "1 4 1 7 ".toCharArray();
|
||||||
private static final int[] BV_TEMPLATE_FILTER = new int[]{9, 8, 1, 6, 2, 4};
|
private static final int[] BV_TEMPLATE_FILTER = new int[]{9, 8, 1, 6, 2, 4};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a <a href="https://www.bilibili.com/">Bilibili</a> AV video id format to BV id format.
|
||||||
|
* <p>
|
||||||
|
* the AV id is a number; the BV id is a special base58 number, it shows as String in programming.<br>
|
||||||
|
* eg:<br>
|
||||||
|
* while the link <i>{@code https://www.bilibili.com/video/BV17x411w7KC/}</i>
|
||||||
|
* shows the same with <i>{@code https://www.bilibili.com/video/av170001/}</i>,
|
||||||
|
* the AV id is <u>{@code 170001}</u>, the BV id is <u>{@code 17x411w7KC}</u>
|
||||||
|
* <p>
|
||||||
|
* for now , the BV id has 10 digits.
|
||||||
|
* the method <b>available while the <u>av-id < 2^27</u></b>, while it theoretically available when the av-id < 2^30.
|
||||||
|
*
|
||||||
|
* @see <a href="https://www.zhihu.com/question/381784377/answer/1099438784">mcfx的回复: 如何看待 2020 年 3 月 23 日哔哩哔哩将稿件的「av 号」变更为「BV 号」?</a>
|
||||||
|
*
|
||||||
|
* @param bv the BV id, a string in (a special) base58 number format, <b>without "BV" prefix</b>.
|
||||||
|
* @return the AV id corresponding to this bv id in <a href="https://www.bilibili.com/">Bilibili</a>, formatted as a number.
|
||||||
|
*/
|
||||||
@Nonnegative
|
@Nonnegative
|
||||||
public static long toAv (@Nonnull String bv) {
|
public static long toAv (@Nonnull String bv) {
|
||||||
long av = 0;
|
long av = 0;
|
||||||
@ -25,6 +42,24 @@ public class BiliTool {
|
|||||||
return (av-V_CONV_ADD)^V_CONV_XOR;
|
return (av-V_CONV_ADD)^V_CONV_XOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a <a href="https://www.bilibili.com/">Bilibili</a> BV video id format to AV id format.
|
||||||
|
* <p>
|
||||||
|
* the AV id is a number; the BV id is a special base58 number, it shows as String in programming.<br>
|
||||||
|
* eg:<br>
|
||||||
|
* while the link <i>{@code https://www.bilibili.com/video/BV17x411w7KC/}</i>
|
||||||
|
* shows the same with <i>{@code https://www.bilibili.com/video/av170001/}</i>,
|
||||||
|
* the AV id is <u>{@code 170001}</u>, the BV id is <u>{@code 17x411w7KC}</u>
|
||||||
|
* <p>
|
||||||
|
* for now , the BV id has 10 digits.
|
||||||
|
* the method <b>available while the <u>av-id < 2^27</u></b>, while it theoretically available when the av-id < 2^30.
|
||||||
|
*
|
||||||
|
* @see <a href="https://www.zhihu.com/question/381784377/answer/1099438784">mcfx的回复: 如何看待 2020 年 3 月 23 日哔哩哔哩将稿件的「av 号」变更为「BV 号」?</a>
|
||||||
|
*
|
||||||
|
* @param av the (base10) AV id.
|
||||||
|
* @return the AV id corresponding to this bv id in <a href="https://www.bilibili.com/">Bilibili</a>,
|
||||||
|
* as a (special) base 58 number format <b>without "BV" prefix</b>.
|
||||||
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static String toBv (@Nonnegative long av) {
|
public static String toBv (@Nonnegative long av) {
|
||||||
av = (av^V_CONV_XOR)+V_CONV_ADD;
|
av = (av^V_CONV_XOR)+V_CONV_ADD;
|
||||||
|
Loading…
Reference in New Issue
Block a user