Skip to content
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

Question on extensions #57

Closed
DaveTheMatcher opened this issue Oct 13, 2020 · 3 comments
Closed

Question on extensions #57

DaveTheMatcher opened this issue Oct 13, 2020 · 3 comments
Labels
question Further information is requested

Comments

@DaveTheMatcher
Copy link

I noticed that if there are multiple AudioFormats for audio download, not all formats get to a .m4a file, but some get to a .weba file.
Is there a way to avoid that?

@sealedtx
Copy link
Owner

@dspolimi Avoid what? For AudioFormat if mime type contains webm - the extention will be .weba, if mime type contains mp4 - the extenstion will be m4a

if (mimeType == null || mimeType.isEmpty()) {
extension = Extension.UNKNOWN;
} else if (mimeType.contains(Extension.MPEG4.value())) {
if (this instanceof AudioFormat)
extension = Extension.M4A;
else
extension = Extension.MPEG4;
} else if (mimeType.contains(Extension.WEBM.value())) {
if (this instanceof AudioFormat)
extension = Extension.WEBA;
else
extension = Extension.WEBM;
} else if (mimeType.contains(Extension.FLV.value())) {
extension = Extension.FLV;
} else if (mimeType.contains(Extension._3GP.value())) {
extension = Extension._3GP;
} else {
extension = Extension.UNKNOWN;
}

@DaveTheMatcher
Copy link
Author

@dspolimi Avoid what? For AudioFormat if mime type contains webm - the extention will be .weba, if mime type contains mp4 - the extenstion will be m4a

if (mimeType == null || mimeType.isEmpty()) {
extension = Extension.UNKNOWN;
} else if (mimeType.contains(Extension.MPEG4.value())) {
if (this instanceof AudioFormat)
extension = Extension.M4A;
else
extension = Extension.MPEG4;
} else if (mimeType.contains(Extension.WEBM.value())) {
if (this instanceof AudioFormat)
extension = Extension.WEBA;
else
extension = Extension.WEBM;
} else if (mimeType.contains(Extension.FLV.value())) {
extension = Extension.FLV;
} else if (mimeType.contains(Extension._3GP.value())) {
extension = Extension._3GP;
} else {
extension = Extension.UNKNOWN;
}

Thank you for the quick answer.
Is there a way to always download m4a files, or do i have to convert the file?

@sealedtx
Copy link
Owner

sealedtx commented Oct 13, 2020

@dspolimi This library does not convert any format itself, it just parses metadata and provide url to formats provided by Youtube. If format is provided with webm format - the file you are going to download is encoded with webm codecs by Youtube and thats how it works. Just select format with extension which suits you.

@sealedtx sealedtx added the question Further information is requested label Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants