#Webpage Thumbnails In Python A small WSGI script that uses selenium's headless PhantomJS driver to capture webpage screenshots, and PIL to resize them. Cropping options could easily be added.
##Dependencies
- Python selenium
- Python PIL
- PhantomJS
| # Installation: | |
| # pip install selenium && curl -O http://chromedriver.storage.googleapis.com/2.8/chromedriver_mac32.zip && unzip chromedriver_mac32.zip && mv ./chromedriver /usr/local/bin/chromedriver | |
| # Resources: | |
| # ChromeDriver: https://code.google.com/p/selenium/wiki/ChromeDriver | |
| # ChromeDriver Getting Started: https://sites.google.com/a/chromium.org/chromedriver/getting-started | |
| # Selenium Python: http://selenium-python.readthedocs.org/en/latest/api.html | |
| from selenium import webdriver |
| from ghost import Ghost | |
| from sys import argv | |
| def main(): | |
| url = argv[1] | |
| path = argv[2] | |
| screenshot(url,path) | |
| def screenshot(url,path): | |
| ghost = Ghost() |
| __author__ = 'pknam' | |
| from selenium import webdriver | |
| import time | |
| def main(): | |
| # browser = webdriver.PhantomJS(executable_path=r"D:\selenium_drivers\phantomjs-2.0.0-windows\bin\phantomjs.exe") | |
| # browser = webdriver.Ie(executable_path=r"D:\selenium_drivers\Internet Explorer(x64)\IEDriverServer.exe") | |
| browser = webdriver.Chrome(executable_path=r"D:\selenium_drivers\Chrome(x86)\chromedriver.exe") |
| ''' | |
| You'll need to install npm, nodejs and phantomjs | |
| $ apt-get install nodejs nodejs-dev npm phantomjs | |
| $ pip install selenium-python | |
| ''' | |
| from selenium import webdriver | |
| from PIL import Image | |
| import datetime | |
| filename = "miri_regev_"+datetime.datetime.now().strftime("%Y.%m.%d.%H:%M:%S")+".png" | |
| fox = webdriver.Firefox() | |
| fox.get('https://www.facebook.com/miri.regev.il') | |
| fox.save_screenshot(filename) # saves screenshot of entire page | |
| fox.quit() |
#Webpage Thumbnails In Python A small WSGI script that uses selenium's headless PhantomJS driver to capture webpage screenshots, and PIL to resize them. Cropping options could easily be added.
##Dependencies
| # Install dependencies | |
| # | |
| # * checkinstall: package the .deb | |
| # * libpcre3, libpcre3-dev: required for HTTP rewrite module | |
| # * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module | |
| apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \ | |
| OLD_DIR=`pwd` && \ | |
| WDIR=~/sources/ && \ | |
| OPENSSL_VER=1.0.2 && \ |
| # Install dependencies | |
| # | |
| # * checkinstall: package the .deb | |
| # * libpcre3, libpcre3-dev: required for HTTP rewrite module | |
| # * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module | |
| apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \ | |
| OLD_DIR=`pwd` && \ | |
| WDIR=~/sources/ && \ | |
| OPENSSL_VER=1.0.2 && \ |
| # Install dependencies | |
| # | |
| # * checkinstall: package the .deb | |
| # * libpcre3, libpcre3-dev: required for HTTP rewrite module | |
| # * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module | |
| apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \ | |
| OLD_DIR=`pwd` && \ | |
| WDIR=~/sources/ && \ | |
| OPENSSL_VER=1.0.1h && \ |
| #!/bin/bash | |
| # | |
| # Nginx build script - [email protected] | |
| # | |
| # Updates code from git/hg repos (or clones if it doesn't exist) for both | |
| # nginx and extra modules, then fires off make | |
| # | |
| # Revision: 3 | |
| # | |
| PREFIX="/usr" |