Code Monkey home page Code Monkey logo

desire2download's People

Contributors

ansis avatar asvoboda avatar kartiktalwar avatar kushp avatar sholiday avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

desire2download's Issues

Forward slash in course names

I have a class named "AFM 131/ARBUS 101", the forward slash is being replaced here, which results in a folder named AFM 131\ being created, inside that is ARBUS 101 - Fall 2012, and inside that are all the files.

I'm not sure what's a good way to deal with this. I don't think it's possible to create a folder with a / in the name in unix. Maybe x.replace('/', ', ')?

URL error when downloading file

Problem

So, I recently encountered this error:

...
 - PHYS 258 - Spring 2012/Module 5. Tests/Q2(FS).pdf (Already Saved)
PHYS 256 - Spring 2012
 - PHYS 256 - Spring 2012/Module 1. Welcome/Welcome_2012.pdf (Already Saved)
Traceback (most recent call last):
  File "/usr/bin/d2d", line 8, in <module>
    load_entry_point('Desire2Download==0.1.2', 'console_scripts', 'd2d')()
  File "/usr/bin/d2d.py", line 163, in main
    d2d.download_tree(document_tree)
  File "/usr/lib/python2.7/site-packages/desire2download.py", line 193, in download_tree
    self.download_tree(node, path)
  File "/usr/lib/python2.7/site-packages/desire2download.py", line 193, in download_tree
    self.download_tree(node, path)
  File "/usr/lib/python2.7/site-packages/desire2download.py", line 198, in download_tree
    self.download_file(root['name'], root['url'], path)
  File "/usr/lib/python2.7/site-packages/desire2download.py", line 240, in download_file
    content = self.br.open_novisit(clean_url).read()
  File "/usr/lib/python2.7/site-packages/mechanize/_mechanize.py", line 199, in open_novisit
    return self._mech_open(url, data, visit=False, timeout=timeout)
  File "/usr/lib/python2.7/site-packages/mechanize/_mechanize.py", line 230, in _mech_open
    response = UserAgentBase.open(self, request, data)
  File "/usr/lib/python2.7/site-packages/mechanize/_opener.py", line 193, in open
    response = urlopen(self, req, data)
  File "/usr/lib/python2.7/site-packages/mechanize/_urllib2_fork.py", line 344, in _open
    '_open', req)
  File "/usr/lib/python2.7/site-packages/mechanize/_urllib2_fork.py", line 332, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/site-packages/mechanize/_urllib2_fork.py", line 1170, in https_open
    return self.do_open(conn_factory, req)
  File "/usr/lib/python2.7/site-packages/mechanize/_urllib2_fork.py", line 1118, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno -2] Name or service not known>
[ktalwar@ubuntu]
...

This I believe is happening because for some reason, the link its trying to download is actually a URL redirect to some section of uwaterloo.ca but is being classified as a file in this line.

Quick Fix

Right now I'm running the script with this fix in place and its doing the job.

desire2download.py - Line 188

for node in root['children']:
    try:
        self.download_tree(node, path)
    except:
        pass

Add pip/easy_install instructions to README

It looks like you already put this up on PyPI, so why not include instructions to install this with pip or easy_install?

It means people don't have to figure out how to download or clone the repo.

New Course Format

The RegEx is not detecting some courses. I'm adding a patch

Courses

AMATH 473/AMATH 673/PHYS 454 - Fall 2012
PHYS 360A/PHYS 360B/PHYS 460A/PHYS 460B - Fall 2012

Fix

re.match('[A-Z]+ [0-9A-Z/\s]{2,45} - [A-Z][a-z]+ 20[0-9]{2}', link.text)

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.