Open SKbarbon opened 8 months ago
same error i have, any solution you found??
same error i have, any solution you found??
in the mean time i did this, i dont know if original dev will or how will fix this, but i changed in lib this
in extractors.py i modified extract_direct_message(data)
and added def convert_timestamp(timestamp_str):
from datetime import datetime
def convert_timestamp(timestamp_str):
try:
# Convert the timestamp from microseconds to seconds
timestamp = int(timestamp_str) / 1000000.0
return datetime.fromtimestamp(timestamp)
except ValueError as e:
# Handle the exception if the timestamp is not a valid number
print(f"Invalid timestamp: {timestamp_str}, Error: {e}")
return None
except OverflowError as e:
# Handle the exception if the timestamp is out of range
print(f"Timestamp out of range: {timestamp_str}, Error: {e}")
return None
def extract_direct_message(data):
data["id"] = data.get("item_id")
if "replied_to_message" in data:
data["reply"] = extract_reply_message(data["replied_to_message"])
if "media_share" in data:
ms = data["media_share"]
if not ms.get("code"):
ms["code"] = InstagramIdCodec.encode(ms["id"])
data["media_share"] = extract_media_v1(ms)
if "media" in data:
data["media"] = extract_direct_media(data["media"])
if "voice_media" in data:
if "media" in data["voice_media"]:
data["media"] = extract_direct_media(data["voice_media"]["media"])
clip = data.get("clip", {})
if 'timestamp' in data:
data['timestamp'] = convert_timestamp(data['timestamp'])
if clip:
if "clip" in clip:
# Instagram ¯\_(ツ)_/¯
clip = clip.get("clip")
data["clip"] = extract_media_v1(clip)
xma_media_share = data.get("xma_media_share", {})
if xma_media_share:
data["xma_share"] = extract_media_v1_xma(xma_media_share[0])
return DirectMessage(**data)
Seems to be a duplicate of #1735
Describe the bug First of all, this issue is appeared with vary set of functions in this package. But this is just one of them.
To Reproduce
Traceback
Expected behavior It Just supposed to work and to do its job. Its not returning anything, only errors.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop: