-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[extractor/common] add generic support for akamai http format extraction
- Loading branch information
1 parent
c4cabf0
commit 193422e
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
193422e
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.
@remitamine blackjack4494/yt-dlc#273
193422e
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 aren't enough information(examples of the manifest URLs and the direct mp4 URLs) to try to test and know what is the problem and what needs to change(either here or in your extractor).
if you can't share those information, i would suggest to look at the SkyIt extractor where it calls these method(from my tests the code works fine), and compare it the execution to your code and the format URLs that your testing on.
193422e
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.
I saw the usage of extract_akamai in the skyit extractor and that gave me the idea to use it the extractor I've written where i manually generate the mp4 direct urls.
For example a sky manifest that works is this:
https://videodemand-vh.akamaihd.net/i/encoded/2020/11/22/1606032590423_uomo-ucciso-da-uno-squale-in-australia_,web_low,web_med,web_high,web_hd,.mp4.csmil/index_0_av.m3u8?null=0
Instead the manifest that creates problems in the extractor i'm writing is:
https://gediusod-vh.akamaihd.net/i/repubblicatv/file/2020/09/22/731397/731397-video-rrtv-,650,200,400,1200,1800,2500,3500,4500,-s200922_iacoboni_salvini.mp4.csmil/index_3_av.m3u8?null=0
more detail in here: blackjack4494/yt-dlc#273
193422e
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.
ok, figured out what the problem is: the \1%s part works only if the %s part is not numeric.
If the qualities array is made of bitrate values if fucks up the re.sub becuase it becomes a non existend group reference like \11500.
so in the example in the skyit extractor the qualities are words like low, med, high etc.. but in most cases the qualities are bitrate values.
The not so elegant solution might be to do the steps one at a time like in the example I gave, but I'm still a python noob so, maybe ther'a a more elegant/easy solution.
193422e
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.
@remitamine solution found: replace \1 with \g<1>
https://stackoverflow.com/questions/5984633/python-re-sub-group-number-after-number
should I do a PR or you do the fix yourself?
193422e
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.
the solution i was about to make is:
but i guess the solution you found on StackOverflow may be better if it works on all Supported version(sometimes Python 2.6 causes problems with unsupported features of new versions).
the part changing, actually it's not needed i forget that i'm using the m3u8 URL.REPL_REGEX
is not relevent, it just to make f4m URLs work as well193422e
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.
i guess it's fine to use
\g<1>
as it's described in multiple place in the Python 2.6 re documentation.193422e
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.
i'm going add the fix right now.