Skip to content

Commit

Permalink
修复 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xuejianxianzun committed Jun 24, 2022
1 parent 231eb23 commit 2a3409e
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 11 deletions.
10 changes: 10 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# 1.9.5 2022/06/24

### 修复 bug

https://www.fanbox.cc/@singlecask/posts/4012918

这篇文章里的 `urlEmbedMap` 字段类型之前没见过,导致了抓取出错,现在修复。

目前对于 `"type": "fanbox.post"` 的内容不进行处理和保存。

# 1.9.4 2022/06/23

### 支持保存嵌入的 url
Expand Down
10 changes: 10 additions & 0 deletions dist/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# 1.9.5 2022/06/24

### 修复 bug

https://www.fanbox.cc/@singlecask/posts/4012918

这篇文章里的 `urlEmbedMap` 字段类型之前没见过,导致了抓取出错,现在修复。

目前对于 `"type": "fanbox.post"` 的内容不进行处理和保存。

# 1.9.4 2022/06/23

### 支持保存嵌入的 url
Expand Down
10 changes: 7 additions & 3 deletions dist/js/content.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/js/content.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Pixiv Fanbox Downloader",
"version": "1.9.4",
"version": "1.9.5",
"manifest_version": 2,
"description": "Pixiv Fanbox 批量下载器。Pixiv Fanbox batch downloader.",
"icons": {
Expand Down
19 changes: 19 additions & 0 deletions docs/fanbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,25 @@ fanbox 所允许上传到投稿里的 file,是有类型限制的,全部类
"type": "default",
"url": "https://drive.google.com/file/d/1G952LsuTESyDjn9oq9hjTxkxoLVvqigX",
"host": "drive.google.com"
},
"SwQufnahqlm2w1HQPBO4Gop5": {
"id": "SwQufnahqlm2w1HQPBO4Gop5",
"type": "fanbox.post",
"postInfo": {
"id": "3964681",
"title": "【先行公開】バニーガール円香(差分有)",
"feeRequired": "500",
"hasAdultContent": true,
"creatorId": "singlecask",
"user": {
"userId": "31699812",
"name": "ぷりけつコーギー",
"iconUrl": "https://pixiv.pximg.net/c/160x160_90_a2_g5/fanbox/public/images/user/31699812/icon/yiMj9sZ7ZNqmAisF5gQhbxnU.jpeg"
},
"coverImageUrl": "https://pixiv.pximg.net/c/1200x630_90_a2_g5/fanbox/public/images/post/3964681/cover/ggUQmQO1rcNnsHDVfMgk08I7.jpeg",
"excerpt": "",
"publishedDatetime": "2022-06-10T19:00:00+09:00"
}
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pixiv-fanbox-downloader",
"version": "1.9.4",
"version": "1.9.5",
"description": "Pixiv Fanbox Downloader",
"repository": "https://github.com/xuejianxianzun/PixivFanboxDownloader",
"author": "xuejianxianzun",
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Pixiv Fanbox Downloader",
"version": "1.9.4",
"version": "1.9.5",
"manifest_version": 2,
"description": "Pixiv Fanbox 批量下载器。Pixiv Fanbox batch downloader.",
"icons": {
Expand Down
22 changes: 21 additions & 1 deletion src/ts/modules/CrawlResult.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,26 @@ interface URLEmbedDataHtml {
html: string
}

interface URLEmbedDataPost {
id: string
type: 'fanbox.post'
postInfo: {
id: string
title: string
feeRequired: string
hasAdultContent: boolean
creatorId: string
user: {
userId: string
name: string
iconUrl: string
}
coverImageUrl: string
excerpt: '' | string
publishedDatetime: string
}
}

// article 投稿数据
interface OnlyArticleData {
type: 'article'
Expand All @@ -157,7 +177,7 @@ interface OnlyArticleData {
[key: string]: EmbedData
}
urlEmbedMap: {
[key: string]: URLEmbedDataDefault | URLEmbedDataHtml
[key: string]: URLEmbedDataDefault | URLEmbedDataHtml | URLEmbedDataPost
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/ts/modules/SaveData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class SaveData {
for (const val of Object.values(data.body.urlEmbedMap)) {
if (val.type === 'default') {
urlArr.push(val.url)
} else {
} else if (val.type === 'html') {
// 尝试从 html 代码中提取 url
const testURL = val.html.match('iframe src="(http.*)"')
if (testURL && testURL.length > 1) {
Expand All @@ -199,8 +199,10 @@ class SaveData {
}
}
}
result.links.text = result.links.text.concat(urlArr.join('\n\n'))
result.links.fileId = this.createFileId()
if (urlArr.length > 0) {
result.links.text = result.links.text.concat(urlArr.join('\n\n'))
result.links.fileId = this.createFileId()
}
}

// 提取 image 投稿的资源
Expand Down

0 comments on commit 2a3409e

Please sign in to comment.