@skrillex1224/chrome-article-publish-extension 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/index.d.ts +0 -1
- package/dist/adapters/index.js +1 -1
- package/dist/{chunk-6KMYIRZU.js → chunk-HHDGQYVN.js} +14 -22
- package/dist/chunk-HHDGQYVN.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-6KMYIRZU.js.map +0 -1
package/dist/adapters/index.d.ts
CHANGED
package/dist/adapters/index.js
CHANGED
|
@@ -1513,7 +1513,7 @@ var BilibiliAdapter = class extends CodeAdapter {
|
|
|
1513
1513
|
};
|
|
1514
1514
|
}
|
|
1515
1515
|
createOpusPayload(article, content, cover) {
|
|
1516
|
-
const tags = article.tags?.filter(Boolean)
|
|
1516
|
+
const tags = article.tags?.filter(Boolean);
|
|
1517
1517
|
const articlePayload = {
|
|
1518
1518
|
category_id: 15,
|
|
1519
1519
|
list_id: 0,
|
|
@@ -2514,7 +2514,7 @@ var CnblogsAdapter = class extends CodeAdapter {
|
|
|
2514
2514
|
return statusRef.url;
|
|
2515
2515
|
}
|
|
2516
2516
|
resolveTags(article) {
|
|
2517
|
-
const tags = article.tags?.map((tag) => tag.trim()).filter(Boolean)
|
|
2517
|
+
const tags = article.tags?.map((tag) => tag.trim()).filter(Boolean);
|
|
2518
2518
|
return tags?.length ? tags : null;
|
|
2519
2519
|
}
|
|
2520
2520
|
/**
|
|
@@ -2727,7 +2727,7 @@ var CSDNAdapter = class extends CodeAdapter {
|
|
|
2727
2727
|
return `${url.pathname}?${query}`;
|
|
2728
2728
|
}
|
|
2729
2729
|
resolveTags(article) {
|
|
2730
|
-
const tags = article.tags?.map((tag) => tag.trim()).filter(Boolean)
|
|
2730
|
+
const tags = article.tags?.map((tag) => tag.trim()).filter(Boolean);
|
|
2731
2731
|
return tags?.length ? tags.join(",") : "article-publish";
|
|
2732
2732
|
}
|
|
2733
2733
|
preserveTaskListMarkers(markdown) {
|
|
@@ -3319,7 +3319,7 @@ var Cto51Adapter = class extends CodeAdapter {
|
|
|
3319
3319
|
return `https://blog.51cto.com/${this.userPath || "blogger"}/${postId}`;
|
|
3320
3320
|
}
|
|
3321
3321
|
resolveTags(article) {
|
|
3322
|
-
return article.tags?.map((tag) => tag.trim()).filter(Boolean).
|
|
3322
|
+
return article.tags?.map((tag) => tag.trim()).filter(Boolean).join(",") || "";
|
|
3323
3323
|
}
|
|
3324
3324
|
async resolveCategory() {
|
|
3325
3325
|
if (this.category) return this.category;
|
|
@@ -3553,10 +3553,6 @@ var IMAGEX_SERVICE_ID = "jm8ajry58r";
|
|
|
3553
3553
|
var IMAGEX_REGION = "cn-north-1";
|
|
3554
3554
|
var IMAGEX_SERVICE = "imagex";
|
|
3555
3555
|
var DOUYIN_READ_AID = "2906";
|
|
3556
|
-
var MAX_TITLE_LENGTH = 20;
|
|
3557
|
-
var MAX_VIDEO_TITLE_LENGTH = 30;
|
|
3558
|
-
var MAX_CAPTION_TEXT_LENGTH = 160;
|
|
3559
|
-
var MAX_VIDEO_CAPTION_TEXT_LENGTH = 1e3;
|
|
3560
3556
|
|
|
3561
3557
|
// src/adapters/platforms/douyin/url.ts
|
|
3562
3558
|
function assertHttpUrl(value, field) {
|
|
@@ -3601,7 +3597,7 @@ async function publishDouyinImageText({
|
|
|
3601
3597
|
});
|
|
3602
3598
|
}
|
|
3603
3599
|
function buildTextPayload(article, context) {
|
|
3604
|
-
const title =
|
|
3600
|
+
const title = article.title.trim();
|
|
3605
3601
|
const bodyText = extractCaptionText(article, context);
|
|
3606
3602
|
const divider = title && !title.endsWith("\u3002") ? "\u3002" : "";
|
|
3607
3603
|
const text = `${title}${divider}${bodyText ? `
|
|
@@ -3660,8 +3656,8 @@ function buildPublishItem(images, textPayload) {
|
|
|
3660
3656
|
function extractCaptionText(article, context) {
|
|
3661
3657
|
const summary = article.summary?.trim();
|
|
3662
3658
|
const source = summary || context.extractBodyText(article);
|
|
3663
|
-
const tags = (article.tags || []).map((tag) => tag.trim().replace(/^#/, "")).filter(Boolean).
|
|
3664
|
-
return [context.normalizeText(source).replace(/\n+/g, " "), tags].filter(Boolean).join("\n").
|
|
3659
|
+
const tags = (article.tags || []).map((tag) => tag.trim().replace(/^#/, "")).filter(Boolean).map((tag) => `#${tag}`).join(" ");
|
|
3660
|
+
return [context.normalizeText(source).replace(/\n+/g, " "), tags].filter(Boolean).join("\n").trim();
|
|
3665
3661
|
}
|
|
3666
3662
|
|
|
3667
3663
|
// src/adapters/platforms/douyin/video.ts
|
|
@@ -3862,7 +3858,7 @@ function buildVideoPublishPayload(article, video, posterUri, cover, context) {
|
|
|
3862
3858
|
return payload;
|
|
3863
3859
|
}
|
|
3864
3860
|
function buildVideoTextPayload(article, context) {
|
|
3865
|
-
const title =
|
|
3861
|
+
const title = article.title.trim();
|
|
3866
3862
|
const bodyText = extractVideoCaptionText(article, context);
|
|
3867
3863
|
const text = [title, bodyText].filter(Boolean).join("\n").trim();
|
|
3868
3864
|
if (!text) {
|
|
@@ -3873,8 +3869,8 @@ function buildVideoTextPayload(article, context) {
|
|
|
3873
3869
|
function extractVideoCaptionText(article, context) {
|
|
3874
3870
|
const summary = article.summary?.trim();
|
|
3875
3871
|
const source = summary || context.extractBodyText(article);
|
|
3876
|
-
const tags = (article.tags || []).map((tag) => tag.trim().replace(/^#/, "")).filter(Boolean).
|
|
3877
|
-
return [context.normalizeText(source).replace(/\n+/g, " "), tags].filter(Boolean).join("\n").
|
|
3872
|
+
const tags = (article.tags || []).map((tag) => tag.trim().replace(/^#/, "")).filter(Boolean).map((tag) => `#${tag}`).join(" ");
|
|
3873
|
+
return [context.normalizeText(source).replace(/\n+/g, " "), tags].filter(Boolean).join("\n").trim();
|
|
3878
3874
|
}
|
|
3879
3875
|
|
|
3880
3876
|
// src/adapters/platforms/douyin/index.ts
|
|
@@ -3992,7 +3988,6 @@ var DouyinAdapter = class extends CodeAdapter {
|
|
|
3992
3988
|
isSuccessResponse: (response) => this.isSuccessResponse(response),
|
|
3993
3989
|
extractBodyText: (article) => this.extractBodyText(article),
|
|
3994
3990
|
normalizeText: (value) => this.normalizeText(value),
|
|
3995
|
-
limitText: (value, maxLength) => this.limitText(value, maxLength),
|
|
3996
3991
|
createCreationId: () => this.createCreationId(),
|
|
3997
3992
|
delay: (ms) => this.delay(ms),
|
|
3998
3993
|
debug: (message, error) => logger7.debug(message, error)
|
|
@@ -4449,9 +4444,6 @@ var DouyinAdapter = class extends CodeAdapter {
|
|
|
4449
4444
|
normalizeText(value) {
|
|
4450
4445
|
return this.decodeHtmlEntities(value).replace(/\r/g, "").replace(/[ \t]+/g, " ").replace(/\n{3,}/g, "\n\n").trim();
|
|
4451
4446
|
}
|
|
4452
|
-
limitText(value, maxLength) {
|
|
4453
|
-
return Array.from(value).slice(0, maxLength).join("").trim();
|
|
4454
|
-
}
|
|
4455
4447
|
buildPublishItem(images, textPayload) {
|
|
4456
4448
|
return buildPublishItem(images, textPayload);
|
|
4457
4449
|
}
|
|
@@ -5000,7 +4992,7 @@ var JuejinAdapter = class extends CodeAdapter {
|
|
|
5000
4992
|
}
|
|
5001
4993
|
return matched.tag_id;
|
|
5002
4994
|
});
|
|
5003
|
-
return [...new Set(matchedTagIds)]
|
|
4995
|
+
return [...new Set(matchedTagIds)];
|
|
5004
4996
|
}
|
|
5005
4997
|
const defaultTag = availableTags[0]?.tag_id;
|
|
5006
4998
|
if (!defaultTag) {
|
|
@@ -5963,7 +5955,7 @@ var SohuAdapter = class extends CodeAdapter {
|
|
|
5963
5955
|
return statusRef.url;
|
|
5964
5956
|
}
|
|
5965
5957
|
resolveTags(article) {
|
|
5966
|
-
return article.tags?.map((tag) => tag.trim()).filter(Boolean).
|
|
5958
|
+
return article.tags?.map((tag) => tag.trim()).filter(Boolean).join(",") || "";
|
|
5967
5959
|
}
|
|
5968
5960
|
};
|
|
5969
5961
|
|
|
@@ -6030,7 +6022,7 @@ var TencentAdapter = class extends CodeAdapter {
|
|
|
6030
6022
|
}
|
|
6031
6023
|
const prepared = await this.prepareArticleContent(article, options);
|
|
6032
6024
|
const cover = article.cover ? await this.uploadCoverByUrl(article.cover) : null;
|
|
6033
|
-
const summary = article.summary || prepared.pureText
|
|
6025
|
+
const summary = article.summary || prepared.pureText;
|
|
6034
6026
|
const payload = {
|
|
6035
6027
|
title: article.title,
|
|
6036
6028
|
title2: "",
|
|
@@ -7740,4 +7732,4 @@ export {
|
|
|
7740
7732
|
ToutiaoAdapter,
|
|
7741
7733
|
WeixinAdapter
|
|
7742
7734
|
};
|
|
7743
|
-
//# sourceMappingURL=chunk-
|
|
7735
|
+
//# sourceMappingURL=chunk-HHDGQYVN.js.map
|