Last active
January 13, 2019 19:54
-
-
Save ShaikeA/d83358199ef46c5379ba257ab0504262 to your computer and use it in GitHub Desktop.
soup getting keywords
This file contains 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
# Narrowing down the space to the article in the page | |
#(since there are many other irrelevant elements in the page) | |
article = soup.find(class_="article-wrapper grid row") | |
# Getting the keywords section | |
keyword_section = soup.find(class_="keywords-section") | |
# Same as: soup.select("div.article-wrapper grid row div.keywords-section") | |
# Getting a list of all keywords which are inserted into a keywords list in line 7. | |
keywords_raw = keyword_section.find_all(class_="keyword") | |
keyword_list = [word.get_text() for word in keywords_raw] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment