Skip to content

Instantly share code, notes, and snippets.

@enginebai
Created April 8, 2017 16:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enginebai/1a984ba2d52b83fbd39a010f5643dcaf to your computer and use it in GitHub Desktop.
Save enginebai/1a984ba2d52b83fbd39a010f5643dcaf to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
# -*- coding: utf8 -*-
from selenium import webdriver
from bs4 import BeautifulSoup
__author__ = "Engine Bai"
url = "https://medium.com/dualcores-studio/make-an-android-custom-view-publish-and-open-source-99a3d86df228"
driver = webdriver.Chrome(executable_path="./driver/chromedriver")
driver.get(url)
content_element = driver.find_element_by_class_name("postArticle-content")
content_html = content_element.get_attribute("innerHTML")
soup = BeautifulSoup(content_html, "html.parser")
p_tags = soup.find_all("p")
for p in p_tags:
print(p.prettify())
driver.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment