diff --git a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java index d7c6301..77615bf 100644 --- a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java +++ b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java @@ -6,5 +6,5 @@ package cc.sukazyo.cono.morny; public class GradleProjectConfigures { public static final String VERSION = "0.8.0.8"; public static final String CODENAME = "putian"; - public static final long COMPILE_TIMESTAMP = 1666028272898L; + public static final long COMPILE_TIMESTAMP = 1666081630449L; } diff --git a/src/main/java/cc/sukazyo/cono/morny/util/BiliTool.java b/src/main/java/cc/sukazyo/cono/morny/util/BiliTool.java index b222828..ef36993 100644 --- a/src/main/java/cc/sukazyo/cono/morny/util/BiliTool.java +++ b/src/main/java/cc/sukazyo/cono/morny/util/BiliTool.java @@ -16,6 +16,23 @@ public class BiliTool { 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}; + /** + * Convert a Bilibili AV video id format to BV id format. + *

+ * the AV id is a number; the BV id is a special base58 number, it shows as String in programming.
+ * eg:
+ * while the link {@code https://www.bilibili.com/video/BV17x411w7KC/} + * shows the same with {@code https://www.bilibili.com/video/av170001/}, + * the AV id is {@code 170001}, the BV id is {@code 17x411w7KC} + *

+ * for now , the BV id has 10 digits. + * the method available while the av-id < 2^27, while it theoretically available when the av-id < 2^30. + * + * @see mcfx的回复: 如何看待 2020 年 3 月 23 日哔哩哔哩将稿件的「av 号」变更为「BV 号」? + * + * @param bv the BV id, a string in (a special) base58 number format, without "BV" prefix. + * @return the AV id corresponding to this bv id in Bilibili, formatted as a number. + */ @Nonnegative public static long toAv (@Nonnull String bv) { long av = 0; @@ -25,6 +42,24 @@ public class BiliTool { return (av-V_CONV_ADD)^V_CONV_XOR; } + /** + * Convert a Bilibili BV video id format to AV id format. + *

+ * the AV id is a number; the BV id is a special base58 number, it shows as String in programming.
+ * eg:
+ * while the link {@code https://www.bilibili.com/video/BV17x411w7KC/} + * shows the same with {@code https://www.bilibili.com/video/av170001/}, + * the AV id is {@code 170001}, the BV id is {@code 17x411w7KC} + *

+ * for now , the BV id has 10 digits. + * the method available while the av-id < 2^27, while it theoretically available when the av-id < 2^30. + * + * @see mcfx的回复: 如何看待 2020 年 3 月 23 日哔哩哔哩将稿件的「av 号」变更为「BV 号」? + * + * @param av the (base10) AV id. + * @return the AV id corresponding to this bv id in Bilibili, + * as a (special) base 58 number format without "BV" prefix. + */ @Nonnull public static String toBv (@Nonnegative long av) { av = (av^V_CONV_XOR)+V_CONV_ADD;