Last active
January 13, 2022 14:50
-
-
Save justfoolingaround/6168a25a598870199aee389c12896c53 to your computer and use it in GitHub Desktop.
An indefinite archillect.com generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import httpx | |
import regex | |
import ujson | |
URL_FIND = regex.compile(r'"url":"(.+?)"') | |
ENDPOINT = "https://archillect.com/socket.io/" | |
def get_sid(session): | |
return ujson.loads(session.get(ENDPOINT, params={'EIO': '3', 'transport': 'polling'}).text[4:-4]).get('sid') | |
def get_image(session, sid): | |
response = session.get(ENDPOINT, params={'EIO': '3', 'transport': 'polling', 'sid': sid}).text | |
if response == '1:1': | |
return get_image(session, get_sid(session)) | |
return URL_FIND.search(response).group(1), sid | |
def get_images(session, sid): | |
while 1: | |
image, sid = get_image(session, sid) | |
yield image | |
client = httpx.Client(headers={'referer': 'https://archillect.com/tv'}, timeout=None) | |
sid = get_sid(client) | |
for image in get_images(client, sid): | |
print(image) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment