-
Notifications
You must be signed in to change notification settings - Fork 9.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[skillshare:course] Add new extractor #16582
Conversation
Added new extractor for skillshare.com classes (you can't link to a specific video).
youtube_dl/extractor/skillshare.py
Outdated
|
||
|
||
class SkillshareBaseIE(InfoExtractor): | ||
_NETRC_MACHINE = 'udemy' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong id.
class SkillshareBaseIE(InfoExtractor): | ||
_NETRC_MACHINE = 'udemy' | ||
|
||
_TN_RE = r"uploads/video/thumbnails/[0-9a-f]+/(?P<width>[0-9]+)-(?P<height>[0-9]+)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Single quotes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should everything be single quotes? @dstftw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you mean make double?
def _login(self): | ||
username, password = self._get_login_info() | ||
if username is None or password is None: | ||
self.raise_login_required("An email and password is needed to download any video (even non-premium ones)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must allow cookie authentication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dstftw I have done some testing and this is not possible, web cookies don't seem to translate to mobile cookies.
from ..utils import int_or_none | ||
|
||
|
||
class SkillshareBaseIE(InfoExtractor): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no point in base class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thought on the base class was to make it simpler to allow more features such single video / playlist downloading later on. @dstftw
youtube_dl/extractor/skillshare.py
Outdated
class_id = self._match_id(url) | ||
class_json = self._download_json(self._CLASS_URL % class_id, | ||
None, | ||
note="Getting class details", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Downloading class JSON
.
|
||
videos.append({ | ||
"id": str(lesson_json["id"]), | ||
"title": lesson_json.get("title"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Title is mandatory.
youtube_dl/extractor/skillshare.py
Outdated
"uploader": class_json["_embedded"].get("teacher", {}).get("full_name"), | ||
"creator": class_json["_embedded"].get("teacher", {}).get("full_name"), | ||
"timestamp": lesson_timestamp, | ||
"uploader_id": str(class_json["_embedded"].get("teacher", {}).get("username", 0)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lack of data is denoted by None
not int
.
youtube_dl/extractor/skillshare.py
Outdated
"ext": "mp4", | ||
"thumbnails": lesson_thumbnails_json, | ||
"uploader": class_json["_embedded"].get("teacher", {}).get("full_name"), | ||
"creator": class_json["_embedded"].get("teacher", {}).get("full_name"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try_get
.
youtube_dl/extractor/skillshare.py
Outdated
"creator": class_json["_embedded"].get("teacher", {}).get("full_name"), | ||
"timestamp": lesson_timestamp, | ||
"uploader_id": str(class_json["_embedded"].get("teacher", {}).get("username", 0)), | ||
"categories": [class_json.get("category")], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No [None]
should be possible.
youtube_dl/extractor/skillshare.py
Outdated
videos = [] | ||
for lesson_json in lessons_json: | ||
lesson_thumbnail_urls = [ | ||
lesson_json.get("video_thumbnail_url", ""), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Processing empty strings is senseless.
Fixed all noted issued except cookie authentication (desktop and mobile don't correlate) and base class (to allow more functionality to be added in the future).
Improved JSON download message.
Hi, this seems to have gone stagnant. @dstftw I have fixed everything except cookie authentication I think (which would require a completely new way of getting the videos). |
I have tested this pull request - works for paid and free content. "Trial Membership" is essentialy a "Premium Membership" |
Is it working? |
Can this be merged? |
It seems like this will never get merged. Closing. |
Added new extractor for skillshare.com classes (you can't link to a specific video).
Please follow the guide below
x
into all the boxes [ ] relevant to your pull request (like that [x])Before submitting a pull request make sure you have:
In order to be accepted and merged into youtube-dl each piece of code must be in public domain or released under Unlicense. Check one of the following options:
What is the purpose of your pull request?
Description of your pull request and other information
Added support for skillshare.com classes such as this using APIs calls extracted from the mobile app.
Tested with both premium and free courses and premium and free users. Works like any other extractor, requires username and password.
Individual video support not added as I can find no way of producing a URL for a specific video.