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

Add support for trilulilu.ro:audio tracks #4068

Closed
nelucampean opened this issue Oct 31, 2014 · 4 comments
Closed

Add support for trilulilu.ro:audio tracks #4068

nelucampean opened this issue Oct 31, 2014 · 4 comments

Comments

@nelucampean
Copy link

Please try to add support for audio tracks on trilulilu,.ro
Audio category url on trilulilu.ro is http://www.trilulilu.ro/?mimetype=audio#ref=mimetype_filter_audio
Example of audio only url from trilulilu.ro: http://www.trilulilu.ro/muzica-rock/freddie-mercury-the-great-pretender-1#ref=home
youtube-dl output with --verbose parameter:

D:\Tools>youtube-dl.exe --ve
rbose http://www.trilulilu.ro/muzica-rock/freddie-mercury-the-great-pretender-1#
ref=home
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['--verbose', 'http://www.trilulilu.ro/muzica-rock/fr
eddie-mercury-the-great-pretender-1#ref=home']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2014.10.30
[debug] Python version 2.7.8 - Windows-8-6.2.9200
[debug] exe versions: ffmpeg N-66521-
[debug] Proxy map: {}
[generic] freddie-mercury-the-great-pretender-1#ref=home: Requesting header
WARNING: Falling back on generic information extractor.
[generic] freddie-mercury-the-great-pretender-1#ref=home: Downloading webpage
[generic] freddie-mercury-the-great-pretender-1#ref=home: Extracting information

ERROR: Unsupported URL: http://www.trilulilu.ro/muzica-rock/freddie-mercury-the-
great-pretender-1#ref=home; please report this issue on https://yt-dl.org/bug .
Be sure to call youtube-dl with the --verbose flag and include its complete outp
ut. Make sure you are using the latest version; type youtube-dl -U to update.
Traceback (most recent call last):
File "youtube_dl\extractor\generic.pyo", line 581, in _real_extract
File "youtube_dl\utils.pyo", line 1629, in parse_xml
File "xml\etree\ElementTree.pyo", line 1300, in XML
File "xml\etree\ElementTree.pyo", line 1642, in feed
File "xml\etree\ElementTree.pyo", line 1506, in _raiseerror
ParseError: syntax error: line 1, column 0
Traceback (most recent call last):
File "youtube_dl\YoutubeDL.pyo", line 533, in extract_info
File "youtube_dl\extractor\common.pyo", line 198, in extract
File "youtube_dl\extractor\generic.pyo", line 962, in _real_extract
ExtractorError: Unsupported URL: http://www.trilulilu.ro/muzica-rock/freddie-mer
cury-the-great-pretender-1#ref=home; please report this issue on https://yt-dl.o
rg/bug . Be sure to call youtube-dl with the --verbose flag and include its comp
lete output. Make sure you are using the latest version; type youtube-dl -U to
update.

@naglis
Copy link

naglis commented Feb 9, 2015

I've looked into it, in order to get the sig part for the audio downloads, we would need to construct/parse an AMF request/response.

@jaimeMF
Copy link
Collaborator

jaimeMF commented Feb 9, 2015

@naglis If you need a starting point, I have a partially implemented AMF 0 reader:

import io

from youtube_dl.utils import struct_unpack

class AmfReader(io.BytesIO):

    # Utility functions for reading numbers and strings
    def read_unsigned_long_long(self):
        return struct_unpack('!Q', self.read(8))[0]

    def read_double(self):
        return struct_unpack('!d', self.read(8))[0]

    def read_unsigned_int(self):
        return struct_unpack('!I', self.read(4))[0]

    def read_unsigned_short(self):
        return struct_unpack('!H', self.read(2))[0]

    def read_unsigned_char(self):
        return struct_unpack('!B', self.read(1))[0]

    def read_amf_string(self):
        length = self.read_unsigned_short()
        return self.read(length)

    def read_amf_value(self):
        value_type = self.read_unsigned_char()
        if value_type == 0:  # Double
            return self.read_double()
        if value_type == 2:  # DataString
            return self.read_amf_string()
        elif value_type == 3:  # DataObject
            data_object = {}
            while True:
                marker = tuple(map(lambda _: self.read_unsigned_char(), range(3)))
                if marker == (0, 0, 9):
                    break
                self.seek(-3, io.SEEK_CUR)
                name = self.read_amf_string()
                data = self.read_amf_value()
                data_object[name] = data
            return data_object
        else:
            raise NotImplementedError('Unsupported type %s' % value_type)


# From https://en.wikipedia.org/wiki/Action_Message_Format#AMF0
r = ' 03 00 04 6e 61 6d 65 02 00 04 4d 69 6b 65 00 03 61 67 65 00 40 3e 00 00 00 00 00 00 00 05 61 6c 69 61 73 02 00 04 4d 69 6b 65 00 00 09'

b = eval('b"""' + r.replace(' ', '\\x') + '"""')
reader = AmfReader(b)
print(reader.read_amf_value())

@naglis
Copy link

naglis commented Feb 9, 2015

Thanks @jaimeMF, I will definitely check it out.

@sandeepkumar8713
Copy link

Hi,

This issue has been solved.Try the following command :
youtube-dl.exe --verbose -x --audio-format mp3 http://www.trilulilu.ro/the-blizzard-yuri-kane-everything-about-you-ft-rel#

Please make sure ffmpeg is install on your system. If not please follow the instructions given here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants