coursera-dl/coursera
Rogério Brito ff134d0915 coursera/api: Skip JSON documents with missing assetId.
Some JSON documents for some courses in Coursera's New Platform don't always
have an `assetId` attribute right below a `definition` attribute.

Since we convert a JSON document to a Python dictionary, we can't
(unfortunately) just go ahead and access something like
`element['definition']['assetId']`.

Important aside: It seems, during my tests with the `graph-analytics` course
that the method `_get_open_course_asset_ids` only gets called with such
"defective" JSON documents, which *may* indicate that the `if` filtering in
the list comprehension is always necessary and the lists returned by
`_get_open_course_asset_ids` are always empty after filtering (again, at
least with this course; haven't tested with others).

We should investigate things better and see what kind of JSON documents get
us there and, if possible, categorize the documents that Coursera spits so
that we have a better idea of what they are sending us and how to behave.

One (wild) idea would be to have a method for each possible type of JSON
document returning the data structures that we need.

Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
2016-02-23 02:06:24 -03:00
..
test Add test for extraction of links from assets provided in a lecture 2016-01-31 22:44:12 +03:00
__init__.py moved coursera script into module and renamed 2013-01-06 21:09:44 -06:00
api.py coursera/api: Skip JSON documents with missing assetId. 2016-02-23 02:06:24 -03:00
cookies.py Deprecate --on-demand option, try to detect class type automatically 2015-09-24 10:15:24 +03:00
coursera_dl.py Merge pull request #415 from gbarboza/patch-2 2016-02-11 02:39:15 -02:00
credentials.py coursera/{cookies,credentials}: Fix more docstrings. 2015-08-14 19:16:34 -03:00
define.py Add extraction of supplementary files from lecture videos 2016-01-31 22:32:02 +03:00
downloaders.py Fix Minor Programming and Spelling Mistakes 2015-08-09 02:00:19 +04:30
network.py Extract supplementary files from [un]gradedProgramming sections 2016-01-29 21:58:12 +03:00
utils.py Extract supplementary files from [un]gradedProgramming sections 2016-01-29 21:58:12 +03:00