Last active
January 1, 2016 12:29
-
-
Save juanriaza/8144461 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
import os | |
import requests | |
from bs4 import BeautifulSoup | |
from selenium import webdriver | |
url = 'http://goo.gl/mff2' | |
print url | |
req = requests.get(url) | |
print req.history | |
print req.url | |
soup = BeautifulSoup(req.text, 'lxml') | |
print soup.title.string.encode('utf-8') | |
print soup.findAll(attrs={"name":"description"})[0]['content'].encode('utf-8') | |
driver = webdriver.Firefox() | |
driver.get(req.url) | |
fname = os.path.join(os.path.dirname(__file__), 'screenshot.png') | |
print fname | |
driver.get_screenshot_as_file(fname) | |
driver.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment