Skip to content

Instantly share code, notes, and snippets.

@huzecong
Created January 29, 2020 21:14

Revisions

  1. huzecong created this gist Jan 29, 2020.
    31 changes: 31 additions & 0 deletions guess_colloquium.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    import itertools
    from typing import List, Optional

    import requests


    def get_url(url_base: str, xs: List[int]) -> str:
    return url_base + "".join(chr(x + 97) for x in xs)


    def attempt(date: str, speaker_last_name: str) -> Optional[str]:
    url_base = f"http://aladdin3.inf.cs.cmu.edu/colcheck/?k={speaker_last_name}_{date}"

    for n_letters in range(0, 2 + 1):
    for xs in itertools.product(*[range(26) for _ in range(n_letters)]):
    url = get_url(url_base, xs)
    r = requests.get(url)
    if b"img" in r.content:
    return url

    return None


    if __name__ == '__main__':
    date = "0124"
    speaker_last_name = "starzl"
    url = attempt(date, speaker_last_name)
    if url is None:
    print("Failed")
    else:
    print(url)