Giter VIP home page Giter VIP logo

learnweb-crawler's Introduction

Crawler for the WWU Learnweb2

This is a crawler written in PHP to download files from the LearnWeb of the WWU and store them into a local directory. This can be e.g. a Dropbox directory, that way you'll have your lectures with you whereever you go.

Requirements

  • PHP 5.3
  • Linux system (probably works under WIN, but not testet)

Installation

Clone the repository:

git clone https://github.com/driehle/learnweb-crawler.git
cd learnweb-crawler

Check for an update of Composer and install dependencies:

php composer.phar self-update
php composer.phar install

Copy the configuration file and edit it to reflect your needs. See below for available configuration options.

cp config.php.dist config.php
vi config.php

Run the update script, ideally you would do this periodically e.g. by cron:

php bin/update.php

Configuration

Credentials

You need to specify the username and the passwort of your ZIV account in username and password setting in the config.php.

If you do not want to specify your password in the config.php, you may create a file password.txt in the same folder and use the following configuration:

        'username' => 'u_user01',
        'password' => trim(file_get_contents(__DIR__ . '/password.txt')),

This may prevent other people seeing your password while you edit the config.php. Keep in mind that the password needs to be stored readable for the Learnweb crawler, for it to be able to access the Learnweb.

Courses

Add all courses you want to crawl to the config.php, see config.php.dist for some examples. There are two types of courses in Learnweb, some use the course view to list files, some use the folder view of Moodle. Looking at the URL you can easily determine which type of course you are dealing with.

Cracking PDF files

Sometimes PDF files have a user password which you need to enter all the time you open the PDF file. Learnweb-Crawler can convert the PDF file to PS and back to PDF which generates a PDF file which can be opened without password. This only works if you know the user password and the tools pdftops and ps2pdf are installed on your system. On Debian simply install these two packages:

apt-get install ghostscript poppler-utils

The actually executed commands may be specified as pdf2PsCmd and ps2PdfCmd in the config.php, see config.php.dist for an example.

Cleaning target directory

If some courses rename files or folders at will, you may end up having several files in the Dropbox twice (or even more). In that case you may want to set "cleanTarget" => true for those Learnweb courses, which makes learnweb crawler delete all files and folders from that directory and the downloads all files again.

To prevent a specific directory from beeing deleted, add a file named .keep to it.

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.