Skip to content

Instantly share code, notes, and snippets.

@juanriaza
Last active January 1, 2016 12:29
Show Gist options
  • Save juanriaza/8144461 to your computer and use it in GitHub Desktop.
Save juanriaza/8144461 to your computer and use it in GitHub Desktop.
# -*- 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