Skip to content

Instantly share code, notes, and snippets.

@a-m-dev
Created August 17, 2019 05:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a-m-dev/9a10dbd961aa41b9bbd708cce2d9eb89 to your computer and use it in GitHub Desktop.
Save a-m-dev/9a10dbd961aa41b9bbd708cce2d9eb89 to your computer and use it in GitHub Desktop.
import requests
from bs4 import BeautifulSoup
response = requests.get('https://www.varzesh3.com').content
x = response.decode('utf8')
# y = x.encode("ascii",'ignore')
# # print(response.text)
soup = BeautifulSoup(x , 'html.parser')
# print(soup)
news = soup.find_all(class_='small-news-link')
for post in news:
print(post['href'], ' >>>> ' , post.get_text())
# f.close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment