Created
June 16, 2020 18:35
-
-
Save mgard/649f73a86fc3dfd23c4cb3441dc0f544 to your computer and use it in GitHub Desktop.
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
| """ | |
| Open a random CVPR talk (oral or spotlight) in the browser | |
| """ | |
| import urllib.request, urllib.error | |
| import webbrowser | |
| import random | |
| URL = "http://cvpr2020.thecvf.com/sites/default/files/2020-03/accepted_list_0.txt" | |
| def getURL(randomId): | |
| x = int(randomId) | |
| url = f"http://d1tz9o43mm5y8k.cloudfront.net/CVPR20/CVPR20/{x}/{x}-oral.mp4" | |
| try: | |
| urllib.request.urlopen(url) | |
| except urllib.error.HTTPError: | |
| # Not an oral, different URL | |
| url = f"http://d1tz9o43mm5y8k.cloudfront.net/CVPR20/CVPR20/{x}/{x}-1min.mp4" | |
| return url | |
| if __name__ == "__main__": | |
| with urllib.request.urlopen(URL) as reqHandle: | |
| validIds = reqHandle.read().split() | |
| randomId = random.choice(validIds) | |
| paperVideoUrl = getURL(randomId) | |
| webbrowser.open(paperVideoUrl) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment