GiovanniBruno22 / PythonBeginners

This repository is meant for new developers to submit first pull requests to and get reviews from peers.
17 stars 22 forks source link

Added random wikipedia article scraper #28

Closed rqnguyen100 closed 11 months ago

rqnguyen100 commented 11 months ago

Random Wikipedia Article #27

Made a folder in the scripts directory to contain two python files that both do similar things.

1) The wikipediaLib.py file uses the wikipedia library to get a summary of the wikipedia article. 2) The wikipediaBS4.py file uses the requests and BeautifulSoup library to get the first paragraph of the wikipedia article.


Using the wikipedia library is much better since you are able to get the full summary rather than just the first paragraph. Using requests and BeautifulSoup is a more general process which may be helpful since it is not restrictive to just wikipedia

Kocho12660 commented 11 months ago

Nice work!

rqnguyen100 commented 11 months ago

I'm running python 3.9.6 so I don't have access to the match function. I decided to rewrite the function using recursion instead of a while loop to prevent needing another loopFlag.

GiovanniBruno22 commented 11 months ago

It now looks much better to me, can you get rid of the _pycache folder and all the .pyc files? Once that is done I will merge the PR in.