fix(publish/sohuhao): align manage URL with v4 console and emit article URL
The v3 manage URL has been retired and now redirects through a login gate, breaking the post-publish "管理" deeplink and login detection. Switch the binding console URL and the adapter SOHU_MANAGE_URL to the v4 contentManagement endpoints, and synthesize external_article_url for publish (not draft) results from the article id and account uid so the publish list can offer a "查看文章" link without an extra fetch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2839,7 +2839,7 @@ const publishBindingDefinitions: Record<string, PublishPlatformBindingDefinition
|
||||
id: "sohuhao",
|
||||
label: "搜狐号",
|
||||
loginUrl: "https://mp.sohu.com/mpfe/v4/login",
|
||||
consoleUrl: "https://mp.sohu.com/mpfe/v4/news/create",
|
||||
consoleUrl: "https://mp.sohu.com/mpfe/v4/contentManagement/news/addarticle",
|
||||
detect: detectSohu,
|
||||
},
|
||||
qiehao: {
|
||||
|
||||
@@ -59,7 +59,7 @@ type SohuAccount = {
|
||||
type SohuPublishType = "publish" | "draft";
|
||||
|
||||
const SOHU_ORIGIN = "https://mp.sohu.com";
|
||||
const SOHU_MANAGE_URL = `${SOHU_ORIGIN}/mpfe/v3/main/first/page?newsType=1`;
|
||||
const SOHU_MANAGE_URL = `${SOHU_ORIGIN}/mpfe/v4/contentManagement/first/page?newsType=1`;
|
||||
const SOHU_PUBLISH_URL = `${SOHU_ORIGIN}/mpbp/bp/news/v4/news/publish/v2`;
|
||||
const SOHU_DRAFT_URL = `${SOHU_ORIGIN}/mpbp/bp/news/v4/news/draft/v2`;
|
||||
|
||||
@@ -249,17 +249,22 @@ async function submitArticle(
|
||||
|
||||
function buildResultPayload(
|
||||
articleId: string,
|
||||
accountId: string,
|
||||
mediaName: string,
|
||||
publishType: SohuPublishType,
|
||||
): Record<string, JsonValue> {
|
||||
const editUrl =
|
||||
`${SOHU_ORIGIN}/mpfe/v4/contentManagement/news/addarticle?spm=smmp.articlelist.0.0&contentStatus=2&id=${encodeURIComponent(articleId)}`;
|
||||
const articleUrl =
|
||||
publishType === "publish"
|
||||
? `https://www.sohu.com/a/${encodeURIComponent(articleId)}_${encodeURIComponent(accountId)}`
|
||||
: null;
|
||||
return {
|
||||
platform: "sohuhao",
|
||||
media_name: mediaName,
|
||||
external_article_id: articleId,
|
||||
external_manage_url: editUrl || SOHU_MANAGE_URL,
|
||||
external_article_url: null,
|
||||
external_article_url: articleUrl,
|
||||
publish_type: publishType,
|
||||
};
|
||||
}
|
||||
@@ -353,7 +358,7 @@ export const sohuhaoAdapter: PublishAdapter = {
|
||||
return {
|
||||
status: "succeeded",
|
||||
summary: publishType === "draft" ? "搜狐号草稿保存成功。" : "搜狐号发布成功。",
|
||||
payload: buildResultPayload(articleId, account.name, publishType),
|
||||
payload: buildResultPayload(articleId, account.id, account.name, publishType),
|
||||
};
|
||||
} catch (error) {
|
||||
return failureResult(error);
|
||||
|
||||
Reference in New Issue
Block a user