diff --git a/parse.py b/parse.py new file mode 100644 index 0000000..c8de571 --- /dev/null +++ b/parse.py @@ -0,0 +1,27 @@ +import sys +import re +import webbrowser + +if len(sys.argv) >= 2: + uni = sys.argv[1] +else: + file = input("Which university do you want to look at? ") + +if len(sys.argv) >= 3: + file = sys.argv[2] +else: + file = input("Which list of universities do you want to parse to an url? ") + +url = f"https://www.lens.org/lens/search/scholar/list?q=author.affiliation.name.keyword:\"{uni}\"" + +url += " AND (" +with open(file) as f: + u = re.sub(r'#.*', '', next(f)).rstrip() + url += f"author.affiliation.name.keyword:\"{u}\"" + for line in f: + u = re.sub(r'#.*', '', line).rstrip() + url += f" OR author.affiliation.name.keyword:\"{u}\"" +url += ")" + +print(url) +webbrowser.open(url)