Comments (36)
Ok perfect. They activated the hide course function, so that the layout classes changed a bit. Thats why the crawler do not find the courses. I will fix this tonight or tomorrow.
from moodle-downloader.
Feature wurde hinzugefügt
from moodle-downloader.
This skript is made for Python 2.7+.
Please try to run the skript with Python 2 instead of Python 3.
from moodle-downloader.
Uuups yeah sorry. Is this Script working for Moodle Version 3.2 ? Seems it doesnt.
from moodle-downloader.
I tested it with versions <= 3.1.
Can you change the loglevel
option to 4 and upload some part of the log?
from moodle-downloader.
I tested it now on 3.2 and there was an error with the course overview page. I fixed that problem, maybe it will work now for you.
from moodle-downloader.
19:24:55 Moodle Crawler started working.
19:24:55 Try to login...
19:24:55 Connection lost! It is not possible to connect to login page!
from moodle-downloader.
Have you set all settings in the config.ini file? Especially url
for authentication? The script will not work with the default config.ini!
If you set all right, maybe you try to connect to a modded version of moodle.
If you post the url I can check.
from moodle-downloader.
For sure I edited the config file.
Moodle URL: https://moodle.hs-hannover.de/login/index.php
Seems like the connection works. Because Moodle marks the crawler as invalid login try to my account.
from moodle-downloader.
Strange. Seems as if they are trying to block bots.
I changed the User-Agent to something familiar and it will print out the Exception now. Perhaps it will help us.
from moodle-downloader.
No they don't block bots. Because I wrote one before. The recursiv folder downloader and the perfect Moodle Headline to Folder structure I tried to implement drove me completely crazy.
10:42:19 Moodle Crawler started working.
10:42:19 Try to login...
10:42:19 Authentication url: 'https://moodle.hs-hannover.de/login/index.php'
10:42:19 Username: ''
10:42:19 Password: ''
10:42:19 Root directory: '/Users/******/Desktop/Moodle'
10:42:21 Download has started.
10:42:21 Download complete.
Traceback (most recent call last):
File "moodleCrawler.py", line 348, in
LoginSoup = BeautifulSoup(LoginContents, "lxml")
File "/usr/local/lib/python2.7/site-packages/bs4/init.py", line 165, in init
% ",".join(features))
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?
from moodle-downloader.
Ok, good.
You have to install a parser library, like lxml.
Just run easy_install lxml
.
http://lxml.de/installation.html
from moodle-downloader.
11:43:21 Moodle Crawler started working.
11:43:21 Try to login...
11:43:21 Authentication url: 'https://moodle.hs-hannover.de/login/index.php'
11:43:21 Username: ''
11:43:21 Password: ''
11:43:21 Root directory: '/Users/*****/Desktop/Moodle'
11:43:23 Download has started.
11:43:23 Download complete.
11:43:23 Logged in!
11:43:23 Searching Courses...
11:43:24 Download has started.
11:43:24 Download complete.
11:43:24 Update Complete
Nothing got downloaded.
from moodle-downloader.
For the moment the crawler only crawls courses in that you are enroled.
So are you enroled in a course?
If you are, get the new version and set the log level to 5. Let's see what we get.
In a few weeks I will add a feature for crawling the whole moodle platform.
from moodle-downloader.
I'm enroled to a ton of courses. Even courses from older semesters are still there. I guess your parses can't handle our site structure. It might be to different. Maybe I should upload our site quell code.
14:01:55 Moodle Crawler started working.
14:01:55 Try to login...
14:01:55 Authentication url: 'https://moodle.hs-hannover.de/login/index.php'
14:01:55 Username: '*****'
14:01:55 Password: ''
14:01:55 Root directory: '/Users//Desktop/Moodle'
14:01:56 Download has started.
14:01:56 No Content-Length available.
14:01:56 Downloaded 81924 bytes
14:01:56 Downloaded 112148 bytes
14:01:56 Download complete.
14:01:56 Logged in!
14:01:56 Searching Courses...
14:01:58 Download has started.
14:01:58 No Content-Length available.
14:01:58 Downloaded 81924 bytes
14:01:58 Downloaded 111978 bytes
14:01:58 Download complete.
14:01:58 Unable to find courses
Traceback (most recent call last):
File "moodleCrawler.py", line 442, in
log("Full page: " + CoursesContentsList, 5)
TypeError: cannot concatenate 'str' and 'Tag' objects
from moodle-downloader.
Ups I forgot to cast the CoursesContentsList object.
If you run the new script it should output the source code of the page.
Or just uplouad the source code of https://moodle.hs-hannover.de/my/.
It should be enough if you upload the part of the "Kursübersicht".
from moodle-downloader.
Hopefully the new update fixed the problem.
from moodle-downloader.
Its getting better. The crawler downloads some of the files. But loads a shit ton of html pages. From the "main" page of the courses some download links are redirected to the real link. As shown in the pictures. Moodle differ a lot from each other. Crazy how every single university got different Moodle pages. So hard to develop a great Crawler or even a CLI.
from moodle-downloader.
Yes that is true!
So if the 2 pictures are from the html files, then there is a bigger folder structure as normal.
Exist in your moodle platform folders in folders?
Like this example:
SomeCourse:
- SomeFiles
- Folder1:
- SomeFiles
- FolderAInFolder1:
- SomeFiles
- MaybeMoreFolders:
- FolderBInFolder1:
- SomeFiles
- MaybeMoreFolders:
- Folder2:
- SomeFiles
- FolderAInFolder2:
- SomeFiles
- MaybeMoreFoldes:
- FolderBInFolder2:
- SomeFiles
- MaybeMoreFoldes:
So that there is more then one layer of folders?
I ask because I didn't see that in any moodle platform so far. But if this is the case I will implement a recrusive folder structure function.
If this is not the case, post some log pieces ,that show how a html file get created when it should not get created.
from moodle-downloader.
Yepp. We got a heck of a moodle structure. Thats the one I mean wich drove me crazy to code my own crawler. And even this internal course stucture is a bit different to every professor.
Ich glaub wir können jetzt auch auf deutsch schreiben. Habe mir mal deine Repos genauer angeschaut und gemerkt das du auch deutsch bist. Hätte ich eigentlich auch von deinem Namen ableiten können. Dein Essay über das falsche Geschlecht fand ich recht lustig! ;)
from moodle-downloader.
Ja stimmt. Danke :D
Ich werde die Tage dann ein Update bringen, damit der Crawler die komplette Ordnerstruktur findet.
Weitere Erweiterungen, z.B. das Symbolische Ordner erkannt werden, kann ich erst hinzufügen wenn ich wieder mehr Zeit habe.
Ist das eine einzige Kursseite in dem Bild? Also nicht zusammengeschnitten?
from moodle-downloader.
Ja das ist ein zusammenhängendes Bild, welches nicht zusammen geschnitten wurde.
from moodle-downloader.
Und wie schaut es aus?
from moodle-downloader.
:D Ich hatte garnicht bemerkt, dass du das Issue wieder geöffnet hast, sorry.
Ich habe mal ein Beta Skript hochgeladen. Ist noch in der Testphase, ich muss noch ein bischen anpassen. Ich werde das alte Skript auf das neue updaten sobald ich alles angepasst habe und es einsatzbereit ist. Wenn du die Betaversion testen willst musst du in der Config zusätzlich "wiki = false" im Abschnitt [crawl] setzen. Das ganze ist wie gesagt Beta also am Besten nicht die alten Dateien überschreiben sondern in einem neuen Ordner testen.
from moodle-downloader.
Also wenn der Beta Crawler jetzt etwas nicht findet dann liegt das eventuell an der Bedienung oder dass es sich um doppelte Dateien handelt welche vom Crawler direkt gelöscht werden.
from moodle-downloader.
Der Crawler im Beta Ordner stürzt immer ab, da er die Config nicht finden kann.
Soll ich den "normalen" Crawler im git root Verzeichnis verwenden? Oder soll ich die alte config in den Beta Ordner packen?
from moodle-downloader.
Die alte Config hättest du in den Beta Ordner legen dürfen. Aber ich habe jetzt das alte Skript mit der neusten Version ersetzt.
from moodle-downloader.
Und was sagst du kann ich das Issue schließen oder fehlen immernoch Dateien?
from moodle-downloader.
File "moodleCoursesApplicants.py", line 243
continue
SyntaxError: 'continue' not properly in loop
from moodle-downloader.
moodleCoursesApplicants.py war ein experimental skript. Es war ist so gut wie fertig gestellt aber wurde nie fertig hochgeladen. Ich habe es mal von github gelöscht bis es wirklich einsetzbar ist. Die Version die online war ist stark veraltet und broken.
from moodle-downloader.
Also welchen Crawler soll ich verwenden? Der in dem Ordner Other Skripts oder den im Root Verzeichnis?
from moodle-downloader.
Traceback (most recent call last):
File "moodleCrawler.py", line 1264, in <module>
crawlMoodlePage(course[1], course[0], current_dir, mainpageURL + "my/")
File "moodleCrawler.py", line 1109, in crawlMoodlePage
crawlMoodlePage(hrefPageLink, nextName, pageDir, pagelink, (depth + 1))
File "moodleCrawler.py", line 979, in crawlMoodlePage
PageLinkContent = donwloadFile(responsePageLink)
File "moodleCrawler.py", line 345, in donwloadFile
downloadFileContentBuffer = downloadFileResponse.read(81924)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 384, in read
data = self._sock.recv(left)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 597, in read
s = self.fp.read(amt)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 384, in read
data = self._sock.recv(left)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 766, in recv
return self.read(buflen)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 653, in read
v = self._sslobj.read(len)
ssl.SSLError: ('The read operation timed out',)
Er lädt auf jedenfall mehr runter aber in einer sehr unschönen Ordnerstruktur.
In dem Beispiel unten, sollten eigentlich 2 Ordner erstellt werden mit dem Namen "Vorlesung" und "Übung" und darin alle einzelnen PDFs. Jetzt werden für jede einzelne PDF ein Ordner angelegt mit selben Namen.
from moodle-downloader.
Traceback (most recent call last):
File "moodleCrawler.py", line 1264, in
crawlMoodlePage(course[1], course[0], current_dir, mainpageURL + "my/")
File "moodleCrawler.py", line 1109, in crawlMoodlePage
crawlMoodlePage(hrefPageLink, nextName, pageDir, pagelink, (depth + 1))
File "moodleCrawler.py", line 979, in crawlMoodlePage
PageLinkContent = donwloadFile(responsePageLink)
File "moodleCrawler.py", line 345, in donwloadFile
downloadFileContentBuffer = downloadFileResponse.read(81924)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 384, in read
data = self._sock.recv(left)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 597, in read
s = self.fp.read(amt)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 384, in read
data = self._sock.recv(left)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 766, in recv
return self.read(buflen)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 653, in read
v = self._sslobj.read(len)
ssl.SSLError: ('The read operation timed out',)eration timed out',)
Dieser Fehler beschreibt nur, dass der Moodle Server nicht mehr geantwortet hat. Das hat nichts mit dem Skript zu tun. Aber danke :D
In dem Beispiel unten, sollten eigentlich 2 Ordner erstellt werden mit dem Namen "Vorlesung" und "Übung" und darin alle einzelnen PDFs. Jetzt werden für jede einzelne PDF ein Ordner angelegt mit selben Namen.
Das wird schwer umzusetzen und ist auch nicht geplant. Der Crawler läd exakt die selbe Struktur wie auf der Platform im Moment. Die Struktur zu verändern würde zu viele Möglichkeiten für Fehler bieten. Vorallem weil es so viele Arten gibt wie man auf Moodle Dateien strukturieren kann...
Wenn ich irgenwann Zeit und Lust habe bastel ich vielleicht mal eine Beta für dein Vorschlag.
Also welchen Crawler soll ich verwenden? Der in dem Ordner Other Skripts oder den im Root Verzeichnis?
Das Skript im Ordner "Other Skripts" ist wie in der Readme Datei (https://github.com/C0D3D3V/Moodle-Crawler/blob/master/src/Other%20skripts/README.md) beschrieben nur ein Skript um alle Kurse einer Moodle Platform zu listen. Sonst kann das Skript noch nichts. Die Liste wird im selben Ordner erstellt wie der wo die Dateien vom MoodleCrawler landen.
Das einzigste Skript das wichtig ist, ist moodleCrawler.py
from moodle-downloader.
Kannst du den Quelltext von einem deiner Kurse hochladen z.B. auf https://gist.github.com/.
Vielleicht den Kurs https://cloud.githubusercontent.com/assets/4007444/23583311/e3ef598a-0140-11e7-8027-4e081641c35d.png
Damit ich weiß wie eure Uni die Abschnitte auf der Course seite macht. Vielleicht baue ich das Feature doch ein.
from moodle-downloader.
Alles klar.
Hier der umfangreiche DB Kurs: https://pastebin.com/hUgTDQWh
Hier ein weiterer eher "Standard" Moodle Kurs: https://pastebin.com/dZxFKDaE
from moodle-downloader.
Yo cool 👍 Langsam geht es in die richtige Richtung 😉
Die Ordnerstruktur ist halbwegs vernüftig. Man kann aufjedenfall mit leben. Es ist sicherlich schneller als manuell alles zu machen 😄
from moodle-downloader.
Related Issues (17)
- Some Ideas:
- #Hacktoberfest
- move config ini HOT 1
- can't login anymore HOT 11
- Where is startup? HOT 3
- Can login but no download (redirect login) HOT 3
- Recursive download bug HOT 4
- Unable to find courses HOT 12
- config value types inside README
- sre_constants.error: bad character range HOT 13
- Unable to log in HOT 2
- Cant login with valid credentials HOT 6
- Credentials don't work with a redirect login HOT 5
- Ein vorschlag für den moodle crawler HOT 2
- HTML Dateien werden öfters heruntergeladen HOT 4
- Crawler is ignoring maxdepth HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moodle-downloader.