Skip to content

Auto-translated map_item updates from 4CAT: tiktok - #101

Draft
4cat-to-zeeschuimer-automation-pr[bot] wants to merge 1 commit into
masterfrom
auto/4cat-map-item-sync-tiktok
Draft

Auto-translated map_item updates from 4CAT: tiktok#101
4cat-to-zeeschuimer-automation-pr[bot] wants to merge 1 commit into
masterfrom
auto/4cat-map-item-sync-tiktok

Conversation

@4cat-to-zeeschuimer-automation-pr

Copy link
Copy Markdown
Contributor

🤖 This PR was auto-generated by the 4CAT map_item sync workflow. The JavaScript was produced by an LLM and requires human review before merging — including manual fixes for any lint warnings flagged below.

Generation parameters

  • Model: gpt-oss-120b (provider: litellm)
  • Total LLM time: 22.65s
  • Trigger: push of c6ac6d4 to 4CAT master (module: tiktok).

Summary

  • ✅ 1 translated
  • ⚠️ 1 translated with lint warnings (require manual fix)
  • ❌ 0 failed
  • ❔ 0 skipped
Datasource Module Time Warnings
datasources/tiktok/search_tiktok.py modules/tiktok.js 22.65s ⚠️ 1

⚠️ Lint warnings — fix before merging

The following datasources translated successfully but the static lint flagged issues that need human fixes. The auto-generated code was spliced into the JS module as-is; please patch the file directly in this PR.

datasources/tiktok/search_tiktok.py -> modules/tiktok.js

  • [helpers_to_add[0]] .get( call found. Python dict.get(k[, default]) does not exist in JavaScript — use the py_get global. NOTE: this check is a plain substring match, so it also flags legitimate JS .get() on Map, URLSearchParams, Headers, etc. — ignore the warning if the receiver is one of those.

datasources/tiktok/search_tiktok.py -> modules/tiktok.js (22.65s) ⚠️

LLM commentary:

Implemented the Python map_item logic in JavaScript. Used the global helpers py_get, normalize_url_encoding, formatUtcTimestamp, and MappedItem. Added a helper getValidThumbnail to replicate the thumbnail‑selection logic (parsing x‑expires query param and picking the last still‑valid URL). All dict.get calls became py_get with appropriate defaults. Python's list comprehensions were translated to map/filter chains. Boolean fields follow the same "yes"/"no" convention. Timestamp conversion uses formatUtcTimestamp which expects seconds. No other external imports are required.

Python diff
diff --git a/datasources/tiktok/search_tiktok.py b/datasources/tiktok/search_tiktok.py
index 4c1bd4ad..63e410f4 100644
--- a/datasources/tiktok/search_tiktok.py
+++ b/datasources/tiktok/search_tiktok.py
@@ -94,6 +94,7 @@ class SearchTikTok(Search):
             "stickers": "\n".join(" ".join(s["stickerText"]) for s in post.get("stickersOnItem", [])),
             "timestamp": datetime.utcfromtimestamp(int(post["createTime"])).strftime('%Y-%m-%d %H:%M:%S'),
             "unix_timestamp": int(post["createTime"]),
+            "is_image_post": "yes" if post.get("imagePost") else "no",
             "is_duet": "yes" if (post.get("duetInfo", {}).get("duetFromId") != "0" if post.get("duetInfo", {}) else False) else "no",
             "is_ad": "yes" if post.get("isAd", False) else "no",
             "is_paid_partnership": "yes" if post.get("adAuthorization") else "no",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant