Uploading new lessons

Well. Nevermind. I wrote a python Selenium script to do just what I said the website should do. Let’s see how many people ask for it.

Maybe I’ll take a screencast and put it on YouTube. Upload Harry Potter book 1 manually using the website: a frustrating hour perhaps? Or run a script, go eat breakfast, and come back to Harry Potter on LingQ

Captcha is evil

I want this bulk import feature!!!

who else does?

Shaun’s program only works for Macs.

I think it would be best if LingQ would give us this bulk import feature.

j:-)

See selenium_approach.py

Usage:
Create a new course in LingQ. Get the course id. You’ll find this in the webaddress

The course id here is 152834

Create your lessons as separate text files. The lessons are sorted in ABC order by the filename… so

01-Lesson1.txt
02-Lesson2.txt
03-Lesson3.txt
etc

Lesson names are created from the file name, so give it a real name

Zip them up then run:

./selenium_approach.py USERNAME PASSWORD LANG COURSEID ZIPNAME

etc:

./selenium_approach.py spatterson NotMyRealPasswordFools de 152834 ./TestZip.zip

Must have selenium/webdriver installed and python

sudo pip install selenium

if you don’t have pip… sudo easy_install pip

should do it.

Good luck

I think this feature would be great for those who regularly import whole eBooks. I did it once and it took me hours.
(sniff, number captchas are gone again)

@mfr
If it needs less time to import, you will do it with pleasure!

j:-)

Yes, LingQ needs a bulk import feature. Reading long texts facilitates moving from intermediate stages to advanced stages of learning a language. Importing a long text in driblets can certainly be done, but self-flagellation is more fun.

Self-flagellation… yes. definitely much more fun.

I uploaded about 40 episodes of Star Trek DS9 today… automatically. How long do you think that would take with the website? An hour? The hell with that. Isn’t language learning SUPPOSE TO BE FUN?!

Captcha is evil

I have never used Python before, but I had it installed so I tried taking the script out for a spin. I got ‘permission denied’ when I run the line

./selenium_approach.py USERNAME PASSWORD LANG COURSEID ZIPNAME

chmod +x ./selenium_approach.py

Oops

BTW, my captcha text is the same as the last post…
Captcha: Skyquest she

@spatterson - Glad to see you came up with a solution here!

What I meant above is that we probably wouldn’t add an API call for this or a way to create multiple lessons out of .zip files. I don’t think this type of solution is straightforward enough for the average user to find value in it. However, a way to do this using a simple UI on the site might be worth looking into. We’ll give this some additional thought.

You don’t think your users are smart enough to name files alphabetically and name the mp3s the same name… and then zip them up? How dumb do you think we are?

If it saves an hour, trust me, people will learn to zip up files

Meanwhile new lessons are added with 0 position in courses, it needs to be corrected manually every time.
The site gets more beautiful but less comfortable after every upgrade :-\

@spatterson - Not at all, I’m sure it’s not very difficult to figure out. I’m just not sure a feature will get used much if it requires people to spend time to learn something in order to use it. This has been our experience in the past. It looks like you’ve managed to find a way to get this to work as you like, so that’s good :slight_smile:

@Ress - This will be fixed in our next update! These Import Lesson page issues were very unfortunate and the site experienced some issues as we scrambled to fend off the attacks two weeks ago. With this next round of updates, the known issues on the Import Lesson page should all be resolved, and we’ll continue to work here to improve this section further.

“get used much if it requires people to spend time to learn something in order to use it”
Um, what? I don’t get it. Who would think bulk upload is NOT a good idea? Comon people. Say something. For or against – I don’t care. But I find in incredibly hard to believe that language learners on this site wouldn’t like the ability to: Download an eBook (legally of course), convert to text, upload to Lingq, and start reading in say… 10 minutes.

A simple batch upload feature would be great.

I pretty much only read long texts these days, since I can get through shorter texts without needing to look up words to get most details. I have basically given up uploading books to Lingq since it’s just painful, especially when a chapter has more than 10,000 words.

@ spatterson

So I got your script working. Looks much better than doing it manually. One problem I had was that if one is not careful, when creating a .zip file on a Mac, it sticks a directory __MAXOSX into the zip file. This causes an error on line 73 of the script when it tries to read in the directly as if it is a file.

Fixed

Captcha: persitency necksFr

Fantastic. I just imported ‘Der Hobbit’ using the script. Much easier. Is there any reason the script needs to open the lessons instead of just saving them? Maybe line 50 can be changed to

saveButton = fox.find_element_by_class_name(‘save-button’)

Is the ten second wait just to make sure the page has loaded? Maybe if the lesson was just being saved and not opened, it could be done quicker.

Yeah, the save button probably would be faster. does it work like?

What language did you important btw? I’ve only tested German

THe 10 second wait is because I’m not an expert with selenium… there is (umm I think??) a way to make sure the page is fully loaded but I don’t know how to do it. So… I put in a 10 second wait.

Captch: Many netto!