Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bilishazam #669

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions __tests__/mediafetch/bilivideo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,17 @@ import fetcher, {
fetchVideoPlayUrlPromise,
} from '../../src/utils/mediafetch/bilivideo';

test.only('dummy fetch', () => {
expect('dummy').toBe('dummy');
});

test('bilivideo', async () => {
const content = await fetcher.regexFetch({
reExtracted: fetcher.regexSearchMatch.exec(
'https://www.bilibili.com/video/BV1aS411A7ir'
'https://www.bilibili.com/video/BV1aS411A7ir',
)!,
});
// console.log(content);
expect(content?.songList[0]?.id).not.toBeUndefined();

const playurl = await fetchVideoPlayUrlPromise({ bvid: 'BV1aS411A7ir' });
// console.log(playurl);
console.log(playurl);

expect(playurl.url).not.toBeUndefined();
});
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
"@react-native/gradle-plugin": "^0.76.3",
"@react-native/metro-config": "^0.76.3",
"@react-native/typescript-config": "0.76.3",
"@react-navigation/drawer": "^7.0.12",
"@react-navigation/native": "^7.0.7",
"@react-navigation/native-stack": "^7.1.8",
"@revenuecat/purchases-js": "^0.13.0",
"@react-navigation/drawer": "^7.0.18",
"@react-navigation/native": "^7.0.13",
"@react-navigation/native-stack": "^7.1.14",
"@revenuecat/purchases-js": "^0.13.1",
"@sentry/react-native": "^6.3.0",
"@sharcoux/slider": "8.0.6",
"@shopify/flash-list": "^1.7.2",
"@shopify/react-native-skia": "1.5.10",
"@shopify/react-native-skia": "1.6.0",
"axios": "^1.7.8",
"base-64": "^1.0.0",
"base64-js": "^1.5.1",
Expand All @@ -61,12 +61,12 @@
"deepmerge": "^4.3.1",
"dropbox": "git+https://[email protected]/lovegaoshi/dropbox-sdk-js.git",
"event-target-polyfill": "^0.0.4",
"expo": "^52.0.11",
"expo-auth-session": "~6.0.0",
"expo": "^52.0.12",
"expo-auth-session": "~6.0.1",
"expo-clipboard": "~7.0.0",
"expo-crypto": "~14.0.1",
"expo-document-picker": "~13.0.1",
"expo-image": "~2.0.2",
"expo-image": "~2.0.3",
"expo-image-picker": "~16.0.3",
"expo-keep-awake": "~14.0.1",
"expo-secure-store": "~14.0.0",
Expand All @@ -85,7 +85,7 @@
"postinstall-postinstall": "^2.1.0",
"qs": "^6.13.1",
"react": "18.3.1",
"react-i18next": "^15.1.2",
"react-i18next": "^15.1.3",
"react-native": "^0.76.3",
"react-native-app-auth": "^8.0.1",
"react-native-background-timer": "git+https://github.com/lovegaoshi/react-native-background-timer.git",
Expand All @@ -98,9 +98,9 @@
"react-native-get-random-values": "^1.11.0",
"react-native-image-colors": "^2.4.0",
"react-native-lyric": "https://[email protected]/lovegaoshi/react-native-lyric.git#commit=6f20e83948c29b0d46833ab9173cd81f99d0ab48",
"react-native-pager-view": "6.5.1",
"react-native-pager-view": "6.6.0",
"react-native-paper": "^5.12.5",
"react-native-purchases": "^8.2.7",
"react-native-purchases": "^8.3.0",
"react-native-qrcode-svg": "^6.3.12",
"react-native-reanimated": "3.16.3",
"react-native-safe-area-context": "^4.14.0",
Expand Down Expand Up @@ -142,7 +142,7 @@
"@types/jest": "^29.5.14",
"@types/lodash": "^4.17.13",
"@types/md5": "^2.3.5",
"@types/node": "^22.10.0",
"@types/node": "^22.10.1",
"@types/react": "~18.3.12",
"@types/react-native": "^0.73.0",
"@types/react-native-background-timer": "^2.0.2",
Expand Down
47 changes: 0 additions & 47 deletions patches/expo-image+2.0.2.patch

This file was deleted.

4 changes: 3 additions & 1 deletion src/utils/mediafetch/bilishazam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { setSongBiliShazamed } from '@objects/Song';
import bfetch from '@utils/BiliFetch';
import { biliTagApiLimiter } from './throttle';
import { logger } from '../Logger';
import { extractSongName } from '../re';

/**
* API that gets the tag of a video. sometimes bilibili identifies the BGM used.
Expand All @@ -27,7 +28,8 @@ const fetchVideoTagPromiseRaw = async ({ bvid, cid }: Ids) => {
const json = await req.json();
try {
if (json.data[0].tag_type === 'bgm') {
return json.data[0].tag_name;
// its like this now?? 发现《Kiss Me More》
return extractSongName(json.data[0].tag_name);
}
return null;
} catch (e) {
Expand Down
Loading
Loading