@anonymous/

FormalYellowgreenLinux

Python

No description

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.6428516393238024","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"I0luc3RhZ3JhbSBUaW1lIElEIGNvbnZlcnRlcgoKaW1wb3J0IGRhdGV0aW1lCnByaW50KCdoZWxsbycpCgpkZWYgZ2V0X2xvY2F0aW9uKCktPnN0cjoKICAgIHJldHVybiBpbnB1dCgnRW50ZXIgdGhlIFVSTCBvZiB0aGUgbG9jYXRpb24gKGZvciBleGFtcGxlOiBodHRwczovL3d3dy5pbnN0YWdyYW0uY29tL2V4cGxvcmUvbG9jYXRpb25zLzk1MDk5NzAyL21nbS1ncmFuZC1sYXMtdmVnYXMvKScpCmRlZiBnZXRfZGF0ZSgpLT4gc3RyOgogICAgcmV0dXJuIGlucHV0KCdFbnRlciB0aGUgZGF0ZSBpbiB0aGlzIGZvcm06IDE5OTkvNy8yNy4uLiAobGVhdmUgbm8gemVyb3MgaW4gZnJvbnQgb2Ygc2luZ2xlIGRpZ2l0IG1vbnRocy9kYXlzKScpCiAgICAKZGVmIGRhdGVfc3RyXzJfZGF0ZW9iaihkYXRlOiBzdHIpIC0+IGRhdGV0aW1lLmRhdGV0aW1lOgogICAgZF9saXN0ID0gZGF0ZS5zcGxpdCgiLyIpCiAgICByZXR1cm4gZGF0ZXRpbWUuZGF0ZXRpbWUoaW50KGRfbGlzdFswXSksIGludChkX2xpc3RbMV0pLCBpbnQoZF9saXN0WzJdKSwgMjMsIDU5LCA1OSkKCmRlZiBkYXRlXzJfdW5peChkYXRlX29iajogZGF0ZXRpbWUuZGF0ZSktPiBpbnQ6CiAgICB1bml4ZGF0ZSA9IGRhdGVfb2JqIC0gZGF0ZXRpbWUuZGF0ZXRpbWUoMTk3MCwxLDEpCiAgICBtc3RpbWUgPSBpbnQodW5peGRhdGUudG90YWxfc2Vjb25kcygpICogMTAwMC4wKQogICAgaW5zdGFfZXBvY2ggPSBtc3RpbWUgLSAxMzE0MjIwMDIxMzAwCiAgICByZXR1cm4gaW5zdGFfZXBvY2gKCmRlZiBiaW5hcnlfZGVjaW1hbF9jb252ZXJ0KGJpbmRlYzogdHVwbGUpLT4gaW50OgogICAgaWYgYmluZGVjWzBdOgogICAgICAgIHJldHVybiBpbnQoYmluKGJpbmRlY1sxXSlbMjpdKQogICAgZWxzZToKICAgICAgICByZXR1cm4gaW50KGJpbmRlY1sxXSwgMikKCmRlZiBiaW5hcnlfbGVuZ3RoZW4oYmluYXJ5OiBpbnQpLT4gaW50OgogICAgemVyb2VzID0gNDEgLSBsZW4oc3RyKGJpbmFyeSkpCiAgICBzaXhfZm91cmJpdCA9ICgnMCcgKiB6ZXJvZXMpICsgc3RyKGJpbmFyeSkgKyAoJzAnICogMjMpCiAgICByZXR1cm4gc2l4X2ZvdXJiaXQKCmRlZiBydW4oKToKICAgIGxvY2F0aW9uX3VybCA9IGdldF9sb2NhdGlvbigpCiAgICB1bml4X3RpbWUgPSBkYXRlXzJfdW5peChkYXRlX3N0cl8yX2RhdGVvYmooZ2V0X2RhdGUoKSkpCiAgICBuZXdiaW4gPSBiaW5hcnlfZGVjaW1hbF9jb252ZXJ0KChUcnVlLCB1bml4X3RpbWUpKQogICAgbG9uZ2JpbiA9IGJpbmFyeV9sZW5ndGhlbihuZXdiaW4pCiAgICBmaW5hbF9udW0gPSBiaW5hcnlfZGVjaW1hbF9jb252ZXJ0KChGYWxzZSwgbG9uZ2JpbikpCiAgICByZXR1cm4gbG9jYXRpb25fdXJsICsgJz9tYXhfaWQ9JyArIHN0cihmaW5hbF9udW0pCgoKcHJpbnQocnVuKCkp"},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#Instagram Time ID converter

import datetime
print('hello')

def get_location()->str:
    return input('Enter the URL of the location (for example: https://www.instagram.com/explore/locations/95099702/mgm-grand-las-vegas/)')
def get_date()-> str:
    return input('Enter the date in this form: 1999/7/27... (leave no zeros in front of single digit months/days)')
    
def date_str_2_dateobj(date: str) -> datetime.datetime:
    d_list = date.split("/")
    return datetime.datetime(int(d_list[0]), int(d_list[1]), int(d_list[2]), 23, 59, 59)

def date_2_unix(date_obj: datetime.date)-> int:
    unixdate = date_obj - datetime.datetime(1970,1,1)
    mstime = int(unixdate.total_seconds() * 1000.0)
    insta_epoch = mstime - 1314220021300
    return insta_epoch

def binary_decimal_convert(bindec: tuple)-> int:
    if bindec[0]:
        return int(bin(bindec[1])[2:])
    else:
        return int(bindec[1], 2)

def binary_lengthen(binary: int)-> int:
    zeroes = 41 - len(str(binary))
    six_fourbit = ('0' * zeroes) + str(binary) + ('0' * 23)
    return six_fourbit

def run():
    location_url = get_location()
    unix_time = date_2_unix(date_str_2_dateobj(get_date()))
    newbin = binary_decimal_convert((True, unix_time))
    longbin = binary_lengthen(newbin)
    final_num = binary_decimal_convert((False, longbin))
    return location_url + '?max_id=' + str(final_num)


print(run())