Last active
August 10, 2019 19:07
-
-
Save joshdabosh/6dec4ae5f07638a86cd958a371e1db50 to your computer and use it in GitHub Desktop.
Scrape Kaomojis
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
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