Created
January 29, 2020 21:14
Revisions
-
huzecong created this gist
Jan 29, 2020 .There are no files selected for viewing
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 charactersOriginal 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)