diff --git a/src/background/messageListeners/moment.ts b/src/background/messageListeners/moment.ts index 42598dba..fff09a9f 100644 --- a/src/background/messageListeners/moment.ts +++ b/src/background/messageListeners/moment.ts @@ -53,13 +53,14 @@ function handleMessage(message: any) { .catch(error => console.error(error)) } - // else if (message.contentScriptQuery === 'getMomentList') { - // const url = `https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all` - // return fetch(url) - // .then(response => response.json()) - // .then(data => (data)) - // .catch(error => console.error(error)) - // } + // https://github.com/SocialSisterYi/bilibili-API-collect/blob/17b7cb85cef19d7f2e94f8d896e68413f6217e26/docs/dynamic/all.md#%E8%8E%B7%E5%8F%96%E5%8A%A8%E6%80%81%E5%88%97%E8%A1%A8 + else if (message.contentScriptQuery === 'getMoments') { + const url = `https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=${message.type}&offset=${message.offset}&update_baseline=${message.updateBaseline}` + return fetch(url) + .then(response => response.json()) + .then(data => (data)) + .catch(error => console.error(error)) + } } function handleConnect() { diff --git a/src/contentScripts/views/Home/Home.vue b/src/contentScripts/views/Home/Home.vue index bc2764f5..50e03ffb 100644 --- a/src/contentScripts/views/Home/Home.vue +++ b/src/contentScripts/views/Home/Home.vue @@ -1,9 +1,23 @@ + + + + diff --git a/src/contentScripts/views/Home/components/Trending.vue b/src/contentScripts/views/Home/components/Trending.vue new file mode 100644 index 00000000..e69de29b diff --git a/src/contentScripts/views/Home/components/types.ts b/src/contentScripts/views/Home/components/types.ts index 90eba0c0..fcc9bc56 100644 --- a/src/contentScripts/views/Home/components/types.ts +++ b/src/contentScripts/views/Home/components/types.ts @@ -104,3 +104,200 @@ export interface AppVideoModel { cover_left_icon_1: number cover_left_icon_2: number } + +export interface MomentModel { + + 'basic': { + 'comment_id_str': string + 'comment_type': 1 + 'like_icon': { + 'action_url': string + 'end_url': string + 'id': 0 + 'start_url': string + } + 'rid_str': string + } + 'id_str': string + 'modules': { + 'module_author': { + 'avatar': { + 'container_size': { + 'height': 1.35 + 'width': 1.35 + } + 'fallback_layers': { + 'is_critical_group': true + 'layers': [ + { + 'general_spec': { + 'pos_spec': { + 'axis_x': 0.675 + 'axis_y': 0.675 + 'coordinate_pos': 2 + } + 'render_spec': { + 'opacity': 1 + } + 'size_spec': { + 'height': 1 + 'width': 1 + } + } + 'layer_config': { + 'is_critical': true + 'tags': { + 'AVATAR_LAYER': {} + 'GENERAL_CFG': { + 'config_type': 1 + 'general_config': { + 'web_css_style': { + 'borderRadius': '50%' + } + } + } + } + } + 'resource': { + 'res_image': { + 'image_src': { + 'placeholder': 6 + 'remote': { + 'bfs_style': string + 'url': string + } + 'src_type': 1 + } + } + 'res_type': 3 + } + 'visible': true + }, + { + 'general_spec': { + 'pos_spec': { + 'axis_x': 0.8000000000000002 + 'axis_y': 0.8000000000000002 + 'coordinate_pos': 1 + } + 'render_spec': { + 'opacity': 1 + } + 'size_spec': { + 'height': 0.41666666666666663 + 'width': 0.41666666666666663 + } + } + 'layer_config': { + 'tags': { + 'GENERAL_CFG': { + 'config_type': 1 + 'general_config': { + 'web_css_style': { + 'background-color': 'rgb(255,255,255)' + 'border': '2px solid rgba(255,255,255,1)' + 'borderRadius': '50%' + 'boxSizing': 'border-box' + } + } + } + 'ICON_LAYER': {} + } + } + 'resource': { + 'res_image': { + 'image_src': { + 'local': 4 + 'src_type': 2 + } + } + 'res_type': 3 + } + 'visible': true + }, + ] + } + 'mid': '928123' + } + 'face': string + 'face_nft': false + 'following': true + 'jump_url': string + 'label': string + 'mid': 928123 + 'name': string + 'official_verify': { + 'desc': string + 'type': 1 + } + 'pendant': { + 'expire': 0 + 'image': string + 'image_enhance': string + 'image_enhance_frame': string + 'name': string + 'pid': 0 + } + 'pub_action': string + 'pub_location_text': string + 'pub_time': string + 'pub_ts': 1696609801 + 'type': string + } + 'module_dynamic': { + 'additional': null + 'desc': null + 'major': { + 'archive': { + 'aid': string + 'badge': { + 'bg_color': '#FB7299' + 'color': '#FFFFFF' + 'icon_url': null + 'text': '投稿视频' + } + 'bvid': 'BV13w411y7E7' + 'cover': 'http://i0.hdslb.com/bfs/archive/15757cde3114b8f19d74ced14ba0694ce20ba1d8.png' + 'desc': '#14' + 'disable_preview': 0 + 'duration_text': '23:37' + 'jump_url': '//www.bilibili.com/video/BV13w411y7E7/' + 'stat': { + 'danmaku': '16' + 'play': '2707' + } + 'title': '【7月】主宰七魔剑 14【独家正版】' + 'type': 1 + } + 'type': 'MAJOR_TYPE_ARCHIVE' + } + 'topic': null + } + 'module_more': { + 'three_point_items': [ + { + 'label': string + 'type': string + }, + ] + } + 'module_stat': { + 'comment': { + 'count': 12 + 'forbidden': false + } + 'forward': { + 'count': 0 + 'forbidden': false + } + 'like': { + 'count': 250 + 'forbidden': false + 'status': false + } + } + } + 'type': 'DYNAMIC_TYPE_AV' + 'visible': true + +}