Skip to content

Commit 9a80f7c

Browse files
committed
New Citations Logic
1 parent 390d006 commit 9a80f7c

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

.github/workflows/update_citations.yml

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

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

3231
- name: Commit and push citations.json

fetch_citations.py

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

3535
pg = ProxyGenerator()
3636

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

40-
if proxy_key:
41+
if SCRAPINGBEE_API_KEY:
4142
try:
42-
proxy_enabled = pg.ScraperAPI(proxy_key)
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+
)
4347

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

5052
except Exception as exc:
5153
print(f"Proxy setup failed: {exc}")

0 commit comments

Comments
 (0)