_pass2journal
)¶from gummy.utils import get_driver
from gummy import gateways
from gummy.gateways import *
Translation-Gummy ver.3.4.4 [success] local driver can be built. [failure] remote driver can't be built. DRIVER_TYPE: local
gateway = gateways.get(input())
utokyo
gateway.supported_journals
['nature', 'sciencedirect', 'springer', 'wiley', 'ieee', 'oxfordacademic', 'rsc', 'nejm']
# from bs4 import BeautifulSoup
# soup = BeautifulSoup(driver.page_source)
# for aTag in soup.find(name="ul", class_="SS_DataBaseIndex").find_all(name="a"):
# print(f"- {aTag.get_text()}: {aTag.get('href')}")
_pass2journal
¶driver = get_driver()
driver = gateway._passthrough_base(driver)
DRIVER_TYPE: local Succeeded to locate element with id=username Succeeded to fill <USERNAME> in element with id=username Succeeded to locate element with id=password Succeeded to fill <PASSWORD> in element with id=password Succeeded to locate element with id=btnSubmit_6 Succeeded to click the element with id=btnSubmit_6 Succeeded to locate element with id=btnContinue Succeeded to click the element with id=btnContinue
driver.get("https://gateway.itc.u-tokyo.ac.jp/,DanaInfo=www.nejm.org,SSL")
current_url = driver.current_url
url, dana_info, _ = current_url.split(",")
print(f"""
* current_url: {current_url}
* url : {url}
* dana_info : {dana_info}
""")
* current_url: https://gateway.itc.u-tokyo.ac.jp/,DanaInfo=www.nejm.org,SSL+ * url : https://gateway.itc.u-tokyo.ac.jp/ * dana_info : DanaInfo=www.nejm.org
def fmt_url_func(cano_url, *args, **kwargs):
gateway_fmt_url = re.sub(
pattern=r"^https?:\/\/www\.nejm\.org\/(doi\/.+)\/(.+)$",
repl=fr"{url}\1/,{dana_info},SSL+\2",
string=cano_url
)
return gateway_fmt_url
cano_url = "https://www.nejm.org/doi/full/10.1056/NEJMcpc1913472"
gateway_fmt_url = "https://gateway.itc.u-tokyo.ac.jp/doi/full/10.1056/,DanaInfo=www.nejm.org,SSL+NEJMcpc1913472"
assert gateway_fmt_url == fmt_url_func(cano_url=cano_url)