-
Notifications
You must be signed in to change notification settings - Fork 10k
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
[dnb] Add new extractor #18725
[dnb] Add new extractor #18725
Conversation
strange... Example: $ python3 -m youtube_dl https://portal.dnb.de/audioplayer/do/show/107679887X
[DNB] 107679887X: Downloading webpage
[download] Downloading playlist: None
[DNB] playlist None: Collected 1 video ids (downloading 1 of them)
[download] Downloading video 1 of 1
ERROR: unable to download video data: HTTP Error 404: Not Found
$ python3 -m youtube_dl https://portal.dnb.de/audioplayer/do/show/107679887X
[DNB] 107679887X: Downloading webpage
[download] Downloading playlist: None
[DNB] playlist None: Collected 1 video ids (downloading 1 of them)
[download] Downloading video 1 of 1
[download] Destination: Gavotte und Bourée aus der 'Französischen Suite Nr. 5' [Elektronische Ressource] _ Johann Sebastian Bach-107679887X.mp3
[download] 100% of 4.48MiB in 00:01
[download] Finished downloading playlist: None Here are some urls to test with: |
|
||
|
||
class DNBIE(InfoExtractor): | ||
_VALID_URL = r'https?://(?:portal\.dnb\.de/audioplayer/do/show/|d-nb\.info/)(?P<id>\w+)[/&]?' |
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.
[/&]?
does not make any sense at the end.
}] | ||
|
||
@staticmethod | ||
def update_and_return_dic(info_dict, update_info): |
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.
Inline.
'id': obj.get('idn'), | ||
'title': obj.get('title'), | ||
'author': obj.get('author'), | ||
'url': 'https://portal.dnb.de/' + obj.get('media_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.
urljoin
.
for obj in objs: | ||
thumbnail = obj.get('cover_url') | ||
if thumbnail: | ||
thumbnail = 'https://portal.dnb.de/' + thumbnail |
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.
urljoin
.
|
||
info_dict = { | ||
'id': obj.get('idn'), | ||
'title': obj.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.
Mandatory. Read coding conventions.
webpage = self._download_webpage(url, video_id) | ||
|
||
m = re.search(r'fdnbpl.media\s*=\s*(\[.*\]);', webpage) | ||
objs = json.loads(m.group(1)) |
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.
_search_regex
, _parse_json
. Again: read coding conventions.
7b956a1
to
5e26784
Compare
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
New extractor for e.g. https://portal.dnb.de/audioplayer/do/show/1077188552