Giter Club home page Giter Club logo

pycrawl's Introduction

Python Webcrawler Thing

Three-day exercise project: slurp a website to local storage

This is an exercise created under the 'three day project paradigm' described by Daniel Moniz in this PyCon talk: https://www.youtube.com/watch?v=ohr6O78jGzs

Due to the three day limit, the functionality is very basic -- see below.

  • Free software: BSD license

Usage

Either run the script from the repo by creating a virtualenv, installing requirements with pip and doing:

./pycrawl/pycrawl.py

Or you can install it (probably into a virtualenv, again) with:

python setup.py install

and use the pycrawl script that becomes available. Calling the script with no arguments displays its usage.

Features

  • Downloads a given website's static content, following <a> and <img src=".."> links within the same domain.
  • Updates links to the same domain so that they will point to the downloaded copies of the files.
  • Accepts a command line option to limit the depth to which links will be followed for downloading.

Bugs and ideas for extension

Features that were not provided due to lack of time:

  • Also download CSS and JS, and update links within CSS (eg. background images).
  • If interrupted, save the necessary internal state to continue later.
  • Do not update links to content that will not be downloaded due to a maximum recursion depth limit.
  • For certain pages (eg. http://outpostdaria.info/essay/rl_daria_temporal_analysis_project.html), rendering the updated document using BeautifulSoup enters an infinite loop. Currently the application just saves the original document unmodified in these cases; it would obviously be better to either fix this bug or work around it by changing the links by some other method.
  • Some pages (eg. http://outpostdaria.info/essay/mq_the_running_gag_theory.html) become mangled after processing, losing formatting and gaining odd characters. Possibly I've missed something involving the character encodings used to generate and save output?

pycrawl's People

Contributors

karlorg avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.