JacobLee23 / FanGraphs-Export

A library for scraping data off of the FanGraphs webpages.
MIT License
14 stars 1 forks source link

Incompatibility with JuPyter Notebook (Playwright ASync API) #44

Open danielkmetz opened 3 years ago

danielkmetz commented 3 years ago

Hey guys,

I apologize if this is annoying. I'm having issues understanding how to actually run the code in a jupyter notebook to scrape the table from the URL at the bottom of this post. When I try and run the code from the example I keep getting an error that reads "It looks like you are using Playwright Sync API inside the asyncio loop. Please use the Async API instead.". Would someone be willing to show me the code I would need to run to get that table? Any help would be greatly appreciated.

https://www.fangraphs.com/leaders/splits-leaderboards?splitArr=42&splitArrPitch=&position=P&autoPt=false&splitTeams=false&statType=player&statgroup=1&startDate=2021-03-01&endDate=2021-11-01&players=&filter=&groupBy=game&sort=-1,1

JacobLee23 commented 3 years ago

According to this issue on the Playwright-Python GitHub repository, when using JuPyter Notebook, the asynchronous Playwright API must be used.

I was notified recently of this issue when I myself tried to use this software in JuPyter. Right now, the fangraphs package uses the Playwright Sync API, not the Playwright ASync API. Lately, I've been refactoring the package so that the various configurations occur during instantiation (as opposed to after instantiation), which would allow for support for the Playwright ASync API. It might take a while, but I'll mention the Pull Request in this issue when it is resolved.

danielkmetz commented 3 years ago

Thanks for the fast response! Can't wait for the update!

danielkmetz commented 3 years ago

Hey Jacob,

Have you found a solution to this bug?

JacobLee23 commented 3 years ago

Sorry it's taking so long. I've been held up with other stuff for the past few weeks, but I've been slowly making progress locally. Hopefully I'll have a solution by mid-August, but I'll get to work pushing my commits here these next two weeks.

danielkmetz commented 2 years ago

How's it coming?

JacobLee23 commented 2 years ago

I'm so sorry it's taking so long. I know what code I need to write, but I've been so held up with school that I haven't been able to write the code. I don't know an exact timetable for completion, but I, personally, want to get it done before playoff season.