MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / get_citation

Function get_citation

web_programming/crawl_google_scholar_citation.py:18–27  ·  view source on GitHub ↗

Return the citation number.

(base_url: str, params: dict)

Source from the content-addressed store, hash-verified

16
17
18def get_citation(base_url: str, params: dict) -> str:
19 """
20 Return the citation number.
21 """
22 soup = BeautifulSoup(
23 httpx.get(base_url, params=params, timeout=10).content, "html.parser"
24 )
25 div = soup.find("div", attrs={"class": "gs_ri"})
26 anchors = div.find("div", attrs={"class": "gs_fl"}).find_all("a")
27 return anchors[2].get_text()
28
29
30if __name__ == "__main__":

Calls 2

getMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected