MCPcopy Create free account
hub / github.com/pollinations/pollinations / generate_linkedin_post

Function generate_linkedin_post

social/scripts/generate_weekly.py:202–236  ·  view source on GitHub ↗
(digest: Dict, token: str)

Source from the content-addressed store, hash-verified

200 temperature=0.8, extra_context=_weekly_image_context())
201
202def generate_linkedin_post(digest: Dict, token: str) -> Optional[Dict]:
203 post = generate_platform_post(
204 "linkedin",
205 digest,
206 token,
207 (
208 "Create a LinkedIn post about this week's development work. "
209 f"The final assembled post including hashtags MUST be {LINKEDIN_MAX_CHARS} characters or fewer "
210 "because Buffer rejects anything longer."
211 ),
212 extra_context=_weekly_image_context(),
213 )
214 if not post:
215 return None
216
217 missing_fields = [field for field in ("hook", "body", "closing") if not post.get(field)]
218 if missing_fields:
219 print(f" FATAL: Weekly LinkedIn post is missing required fields: {', '.join(missing_fields)}")
220 return None
221
222 full_post = build_linkedin_post_text(post)
223 if not full_post:
224 print(" FATAL: Weekly LinkedIn post text is empty")
225 return None
226
227 char_count = len(full_post)
228 post["full_post"] = full_post
229 post["char_count"] = char_count
230 if char_count > LINKEDIN_MAX_CHARS:
231 print(
232 f" FATAL: Weekly LinkedIn post is {char_count} chars, exceeds Buffer limit of {LINKEDIN_MAX_CHARS}"
233 )
234 return None
235
236 return post
237
238def generate_instagram_post(digest: Dict, token: str) -> Optional[Dict]:
239 return generate_platform_post("instagram", digest, token,

Callers 1

mainFunction · 0.85

Calls 4

generate_platform_postFunction · 0.90
build_linkedin_post_textFunction · 0.90
_weekly_image_contextFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected