Skip to content

Instantly share code, notes, and snippets.

@kirussian911
Created August 18, 2018 22:35
Show Gist options
  • Save kirussian911/5f7e99a9bd431fb01f48bb89f413a0b0 to your computer and use it in GitHub Desktop.
Save kirussian911/5f7e99a9bd431fb01f48bb89f413a0b0 to your computer and use it in GitHub Desktop.
import requests
from bs4 import BeautifulSoup as BS
def get_html(url):
r = requests.get(url)
return r.text
def get_data(html):
soup = BS(html, 'html.parser')
title = soup.findChildren('h2', {'class':'entry-title'}).text
return title
def main():
url = 'https://aliholic.com/shop/page/1/'
print(get_data(get_html(url)))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment