Skip to content

Instantly share code, notes, and snippets.

View xihuny's full-sized avatar
🚀
Indie Hacking

Ali xihuny

🚀
Indie Hacking
View GitHub Profile
@xihuny
xihuny / sun_vaahaka_scraper.py
Last active February 8, 2018 04:20
Simply python script to scrape latest stories from sun.mv website.
from bs4 import BeautifulSoup as bs
from requests import get
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'}
content = bs(get("https://sun.mv/story", headers=headers).content, "html5lib")
for x in content.find_all("a", class_="feetha-news"):
print x['href']
print x.find("strong", class_="thaana_bold").text