28 lines
695 B
Python
28 lines
695 B
Python
|
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)
|