使用LinkedIn API发布企业主页内容时遇文本截断问题
LinkedIn API发布内容含括号时被截断的解决方法
问题描述
使用LinkedIn API向企业主页发布内容时,当文本中包含括号(),发布后的内容会被截断,括号及后续的文本(包括话题标签)无法正常显示。
请求Payload如下:
{ "author": "urn:li:organization:99061641", "commentary": "🎨🌟🌌 Key takeaways from the recent webinar on Challenging Artistic Canons! 🌌🌟🎨\n\n * 📜 Artistic greatness has no definitive canon, it's subjective and open to debate. 🤔💭\n * 🔥 Lists of the greatest movies or works of art are meant to spark passionate discussions and challenge conventional wisdom. 💥🎥\n * 🤝 Use the information as a handy reference guide and challenge your own personal canons. 📚🔍💡\n * 💡 Push boundaries, think outside the box, and embrace diverse perspectives for artistic growth. 🌈🚀\n\n \n\n \n\n( Let's continue to challenge the norms and redefine greatness in art! )\n\n \n\n \n\n#ArtisticGreatness #ChallengingCanons #DebateAndInspire #ThinkOutsideTheBox #ArtisticGrowth #DiversePerspectives", "visibility": "PUBLIC", "distribution": { "feedDistribution": "MAIN_FEED", "targetEntities": [], "thirdPartyDistributionChannels": [] }, "lifecycleState": "PUBLISHED" }
原因分析
LinkedIn API的文本解析逻辑对未转义的括号()存在识别异常,会将括号视为内容的结束边界,导致后续文本被丢弃。
解决方法
对文本中的括号进行HTML转义处理,将(替换为(,)替换为),确保API能正确解析完整内容。
修改后的Payload示例:
{ "author": "urn:li:organization:99061641", "commentary": "🎨🌟🌌 Key takeaways from the recent webinar on Challenging Artistic Canons! 🌌🌟🎨\n\n * 📜 Artistic greatness has no definitive canon, it's subjective and open to debate. 🤔💭\n * 🔥 Lists of the greatest movies or works of art are meant to spark passionate discussions and challenge conventional wisdom. 💥🎥\n * 🤝 Use the information as a handy reference guide and challenge your own personal canons. 📚🔍💡\n * 💡 Push boundaries, think outside the box, and embrace diverse perspectives for artistic growth. 🌈🚀\n\n \n\n \n\n( Let's continue to challenge the norms and redefine greatness in art! )\n\n \n\n \n\n#ArtisticGreatness #ChallengingCanons #DebateAndInspire #ThinkOutsideTheBox #ArtisticGrowth #DiversePerspectives", "visibility": "PUBLIC", "distribution": { "feedDistribution": "MAIN_FEED", "targetEntities": [], "thirdPartyDistributionChannels": [] }, "lifecycleState": "PUBLISHED" }
验证步骤
- 使用修改后的Payload重新调用LinkedIn发布API
- 查看发布后的企业主页动态,确认括号及后续所有文本(包括话题标签)均完整显示
内容的提问来源于stack exchange,提问作者Somyaranjan Kar
相关产品推荐
相关产品推荐

