Skip to content

Instantly share code, notes, and snippets.

View adw0rd's full-sized avatar
:octocat:
I may be slow to respond.

Mikhail Andreev adw0rd

:octocat:
I may be slow to respond.
View GitHub Profile
class InstagramIdCodec:
ENCODING_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
@staticmethod
def encode(num, alphabet=ENCODING_CHARS):
"""Covert a numeric value to a shortcode."""
num = int(num)
if num == 0:
return alphabet[0]
arr = []
[
{
"pk": "2727789085090382414",
"id": "2727789085090382414_4400476624",
"code": "CXbDbhvAAJO",
"taken_at": "2021-12-13T12:17:00+00:00",
"taken_at_ts": 1639397820,
"media_type": 8,
"product_type": "carousel_container",
"thumbnail_url": null,