From 7e63d9c95605b07674902778f4b1ae4b9ff1ce35 Mon Sep 17 00:00:00 2001 From: AccentuSoft Date: Thu, 10 Feb 2022 10:57:46 +0200 Subject: [PATCH] Add resolution for finding when a TikTok video was published, and who published it. --- .../Core/TikTokVideoPublishDetails.py | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Core/Resolutions/Core/TikTokVideoPublishDetails.py diff --git a/Core/Resolutions/Core/TikTokVideoPublishDetails.py b/Core/Resolutions/Core/TikTokVideoPublishDetails.py new file mode 100644 index 0000000..291e542 --- /dev/null +++ b/Core/Resolutions/Core/TikTokVideoPublishDetails.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 + + +class TikTokVideoPublishDetails: + # A string that is treated as the name of this resolution. + name = "TikTok Video Publishing Details" + + # A string that describes this resolution. + description = "Extracts information from public TikTok Videos." + + originTypes = {'Website'} + + resultTypes = {'Social Media Handle', 'Date'} + + parameters = {} + + def resolution(self, entityJsonList, parameters): + from datetime import datetime + + returnResults = [] + + for entity in entityJsonList: + uid = entity['uid'] + url = entity['URL'].lower() + + try: + splitURL = url.split('/') + username = splitURL[3] + videoID = int(splitURL[5].split('?')[0]) + except (IndexError, ValueError): + continue + + binString = "{0:b}".format(videoID) + if len(binString) == 63: + binString = '0' + binString + binString = int(binString[:32], 2) + + UTCTimestamp = datetime.utcfromtimestamp(binString).isoformat() + '+00:00' + + returnResults.append([{'Date': UTCTimestamp, + 'Entity Type': 'Date'}, + {uid: {'Resolution': 'Video Publish Date', 'Notes': ''}}]) + returnResults.append([{'User Name': username, + 'Entity Type': 'Social Media Handle'}, + {uid: {'Resolution': 'Published By', 'Notes': ''}}]) + + return returnResults