Created
March 21, 2019 14:41
-
-
Save Bilguun132/ebeeadcdc083f4a1b2f6e2fc8fad970c to your computer and use it in GitHub Desktop.
python-scraping-tutorial-github-trending
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| from bs4 import BeautifulSoup | |
| page = requests.get('https://github.com/trending') | |
| # Create a BeautifulSoup object | |
| soup = BeautifulSoup(page.text, 'html.parser') | |
| # get the repo list | |
| repo = soup.find(class_="repo-list") | |
| # find all instances of that class (should return 25 as shown in the github main page) | |
| repo_list = repo.find_all(class_='col-12 d-block width-full py-4 border-bottom') | |
| print(len(repo_list)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment