Skip to content

Commit 4573996

Browse files
committed
New Citations Logic
1 parent 9a80f7c commit 4573996

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

.github/workflows/update_citations.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ jobs:
2525

2626
- name: Fetch citation counts
2727
env:
28-
SCRAPINGBEE_API_KEY: ${{ secrets.SCRAPINGBEE_API_KEY }}
28+
SCHOLARLY_USE_PROXY: "scraperapi"
29+
SCRAPERAPI_KEY: ${{ secrets.SCRAPERAPI_KEY }}
2930
run: python fetch_citations.py
3031

3132
- name: Commit and push citations.json

fetch_citations.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,18 @@ def get_title_from_doi(doi: str) -> str | None:
3434

3535
pg = ProxyGenerator()
3636

37-
SCRAPINGBEE_API_KEY = os.getenv("SCRAPINGBEE_API_KEY")
38-
37+
proxy_key = os.getenv("SCRAPERAPI_KEY")
3938
proxy_enabled = False
4039

41-
if SCRAPINGBEE_API_KEY:
40+
if proxy_key:
4241
try:
43-
proxy_enabled = pg.SingleProxy(
44-
http=f"http://{SCRAPINGBEE_API_KEY}:@proxy.scrapingbee.com:8886",
45-
https=f"http://{SCRAPINGBEE_API_KEY}:@proxy.scrapingbee.com:8886",
46-
)
42+
proxy_enabled = pg.ScraperAPI(proxy_key)
4743

4844
if proxy_enabled:
4945
scholarly.use_proxy(pg)
50-
print("ScrapingBee proxy enabled")
46+
print("ScraperAPI proxy enabled")
47+
else:
48+
print("Failed to enable ScraperAPI proxy")
5149

5250
except Exception as exc:
5351
print(f"Proxy setup failed: {exc}")

0 commit comments

Comments
 (0)