Skip to content

Instantly share code, notes, and snippets.

@joshdabosh
Last active August 10, 2019 19:07
Show Gist options
  • Save joshdabosh/6dec4ae5f07638a86cd958a371e1db50 to your computer and use it in GitHub Desktop.
Save joshdabosh/6dec4ae5f07638a86cd958a371e1db50 to your computer and use it in GitHub Desktop.
Scrape Kaomojis
from bs4 import BeautifulSoup as bs
import requests
import json
url = "http://kaomoji.ru/en/"
page = requests.get(url)
soup = bs(page.content, "html.parser")
kaomojis = []
content = soup.find("div", {"id":"content"})
for mobile in content.findAll("div", {"class":"mobile_friendly"}):
rows = mobile.findAll(lambda tag: tag.name=="span")
for i in rows:
kaomojis.append(i.text)
f = open("kaomojis.txt", "w")
f.write(json.dumps(kaomojis[6:]))
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment