edx-dl icon indicating copy to clipboard operation
edx-dl copied to clipboard

Download failed with "AttributeError: 'NoneType' object has no attribute 'string'"

Open scottgmcleod opened this issue 4 years ago • 17 comments

Subject of the issue

Download failed with "AttributeError: 'NoneType' object has no attribute 'string'"

Your environment

  • Operating System (name/version): MacOS 10.14.6
  • Python version:3.6
  • youtube-dl version:2020.03.01
  • edx-dl version:0.1.13

Steps to reproduce

Tell us how to reproduce this issue. Please provide us the course URL, and the specific subsection or unit if possible. The tool sees the course I am enrolled in at Stanford but when I try to download the url (https://lagunita.stanford.edu/courses/HumanitiesSciences/StatLearning/Winter2016/course/) it fails.

Expected behaviour

It should commence the download

Actual behaviour

Output from edx-dl -x stanford -u [email protected] https://lagunita.stanford.edu/courses/HumanitiesSciences/StatLearning/Winter2016/course/

edx_dl version 0.1.13 Password: Building initial headers for future requests. Getting initial CSRF token. Found CSRF token. Logging into Open edX site: https://lagunita.stanford.edu/login_ajax Extracting course information from dashboard. Traceback (most recent call last): File "/Users/scottm/miniconda2/bin/edx-dl", line 8, in sys.exit(main()) File "/Users/scottm/miniconda2/lib/python3.6/site-packages/edx_dl/edx_dl.py", line 1028, in main for selected_course in selected_courses} File "/Users/scottm/miniconda2/lib/python3.6/site-packages/edx_dl/edx_dl.py", line 1028, in for selected_course in selected_courses} File "/Users/scottm/miniconda2/lib/python3.6/site-packages/edx_dl/edx_dl.py", line 186, in get_available_sections sections = page_extractor.extract_sections_from_html(page, BASE_URL) File "/Users/scottm/miniconda2/lib/python3.6/site-packages/edx_dl/parsing.py", line 403, in extract_sections_from_html for i, section_soup in enumerate(sections_soup, 1)] File "/Users/scottm/miniconda2/lib/python3.6/site-packages/edx_dl/parsing.py", line 403, in for i, section_soup in enumerate(sections_soup, 1)] File "/Users/scottm/miniconda2/lib/python3.6/site-packages/edx_dl/parsing.py", line 392, in _make_subsections for i, s in enumerate(subsections_soup, 1)] File "/Users/scottm/miniconda2/lib/python3.6/site-packages/edx_dl/parsing.py", line 392, in for i, s in enumerate(subsections_soup, 1)] AttributeError: 'NoneType' object has no attribute 'string'

scottgmcleod avatar Mar 05 '20 15:03 scottgmcleod

Exact same issue for me, except I'm on Python 2.7.

Ken0sis avatar Mar 06 '20 08:03 Ken0sis

The tool does work for an edX course I took. But not lagunita...

scottgmcleod avatar Mar 06 '20 14:03 scottgmcleod

Same error on lagunita. Ubuntu 19.10, python 3.7.5 (system)

fixfo avatar Mar 08 '20 07:03 fixfo

Same error for me ..! I am using Python 2.7.14 on Windows 10

I can download edx courses ..! But I am facing issue in lagunita.stanford.edu

Is there anyother way to download, as Lagunita is retiring and will shut down at 12 noon Pacific Time on March 31, 2020.

mohan-barathi avatar Mar 08 '20 16:03 mohan-barathi

Same error for me ..! I am using Python 2.7.14 on Windows 10

I can download edx courses ..! But I am facing issue in lagunita.stanford.edu

Is there anyother way to download, as Lagunita is retiring and will shut down at 12 noon Pacific Time on March 31, 2020.

Replace your parsing.py with the one found in the zip file below. parsing.zip

MATRIX30 avatar Mar 09 '20 01:03 MATRIX30

MATRIX30's edit of the parsing.py file seems to work for me. Thank you!

Ken0sis avatar Mar 09 '20 05:03 Ken0sis

Yep Worked for me too. Thanks MATRIX30!

scottgmcleod avatar Mar 09 '20 13:03 scottgmcleod

"ERROR: This video is no longer available due to a copyright claim by Stanford University. Sorry about that."😭

parsing.py works great but failed before copyright claim:(

ny83427 avatar Mar 10 '20 20:03 ny83427

@ny83427 comment out line 42 on utils.py, and add a print statement print (e, "move on..!")

Usually introduction videos are with copyrights .. you can download them manually ..!! 🔨 (quick fix..!)

mohan-barathi avatar Mar 11 '20 19:03 mohan-barathi

@mohan-barathi HOLY COW! This works like a charm. Thank you so much, dude!

ny83427 avatar Mar 12 '20 01:03 ny83427

Thanks

ichit avatar Mar 12 '20 03:03 ichit

@ny83427 comment out line 42 on utils.py, and add a print statement print (e, "move on..!")

Usually introduction videos are with copyrights .. you can download them manually ..!! 🔨 (quick fix..!)

I do think the workflow of the code can be improved a little bit as you suggested, currently, one failure will stop the whole world, which is the worst scearnio. Continue fetching other resources while output an error list would be more friendly.

ny83427 avatar Mar 12 '20 03:03 ny83427

It's not working for me for lagunita. Same string error is coming even after replacing parsing.py as suggested by MATRIX20. ERROR

edx_dl version 0.1.13 Building initial headers for future requests. Getting initial CSRF token. Found CSRF token. Logging into Open edX site: https://lagunita.stanford.edu/login_ajax Extracting course information from dashboard. Traceback (most recent call last): File "/usr/local/bin/edx-dl", line 10, in sys.exit(main()) File "/usr/local/lib/python2.7/dist-packages/edx_dl/edx_dl.py", line 1028, in main for selected_course in selected_courses} File "/usr/local/lib/python2.7/dist-packages/edx_dl/edx_dl.py", line 1028, in for selected_course in selected_courses} File "/usr/local/lib/python2.7/dist-packages/edx_dl/edx_dl.py", line 186, in get_available_sections sections = page_extractor.extract_sections_from_html(page, BASE_URL) File "/usr/local/lib/python2.7/dist-packages/edx_dl/parsing.py", line 403, in extract_sections_from_html for i, section_soup in enumerate(sections_soup, 1)] File "/usr/local/lib/python2.7/dist-packages/edx_dl/parsing.py", line 392, in _make_subsections for i, s in enumerate(subsections_soup, 1)] AttributeError: 'NoneType' object has no attribute 'string'

RakeshIIITD avatar Mar 15 '20 19:03 RakeshIIITD

@RakeshIIITD Replacing parsing.py is not enough.please check @mohan-barathi 's solution:

comment out line 42 on utils.py, and add a print statement print (e, "move on..!")

This works at least for me.

ny83427 avatar Mar 15 '20 22:03 ny83427

thanks

Druadach avatar Mar 29 '20 07:03 Druadach

None pf these solutions work anymore.

numlockkey avatar Apr 02 '20 12:04 numlockkey

@numlockkey Because the lagunita.stanford.edu is closed on 31-March-2020. That's the reason we were trying the downloads with workarounds, and didn't concentrate on fixing. 😃

mohan-barathi avatar Apr 05 '20 11:04 mohan-barathi