Rudloff / alltube

Web GUI for youtube-dl
GNU General Public License v3.0
2.96k stars 582 forks source link

Different video format gotten from website and as library. #260

Closed ch4rc0al1080 closed 4 years ago

ch4rc0al1080 commented 4 years ago

Different video format gotten from website and as library.

Your environment

Please answer these questions when reporting a new issue:

What is your operating system (Windows, Linux, OSX, etc.)? Ubuntu 18.04 LTS What is your web server (Apache, IIS, etc.)? Apache2 What version of AllTube are you using? LTS by 2020-02-12 How did you install AllTube (with Git or with a release package)? Git What version of PHP are you using? 7.2.24 What version of Python are you using? 3.6.9 What version of youtube-dl are you using? 2020.01.01 Do you get any PHP-related errors in your webserver's logs? no What is the content of your config/config.yml file?

---
# Path to your youtube-dl binary
youtubedl: vendor/rg3/youtube-dl/youtube_dl/__main__.py

# Path to your python binary
python: /usr/bin/python3

# An array of parameters to pass to youtube-dl
params:
    - --no-warnings
    - --ignore-errors
    - --flat-playlist
    - --restrict-filenames
    - --no-playlist

# True to enable audio conversion
convert: true

# True to enable advanced conversion mode
convertAdvanced: true

# List of formats available in advanced conversion mode
convertAdvancedFormats: [mp3, avi, flv, wav]

# Path to your avconv or ffmpeg binary
avconv: vendor/bin/ffmpeg

# avconv/ffmpeg logging level.
avconvVerbosity: error

# Path to the directory that contains the phantomjs binary.
phantomjsDir: vendor/bin/

# True to disable URL rewriting
uglyUrls: false

# True to stream videos through server
stream: true

# True to enable remux mode (merge best audio and best video)
remux: true

# MP3 bitrate when converting (in kbit/s)
audioBitrate: 128

# App name
appName: AllTube Download

# Generic formats supported by youtube-dl
genericFormats:
    best: Best
    bestvideo+bestaudio: Remux best video with best audio
    worst: Worst

Describe your issue

I use Alltube as a libaray to get pornhub videos . But recently I found that when I get a pornhub video by website(Alltube website I bulit),I can get a 'mp4' file, but I can only get 'm3u8' file while using it as a function.

my Alltube website: https://52proxy.fun/ytb/

ch4rc0al1080 commented 4 years ago

When I use Alltube as a library.I use this options

Config::setOptions(
    [
        'youtubedl' => '/usr/local/bin/youtube-dl',
        'python'    => '/usr/bin/python3',
        'params'    => array("--no-warnings","--ignore-errors","--flat-playlist","--restrict-filenames","--no-playlist"),

    ]
);

And I try to get specific videos by using

$video = new Video($url, 'mp4');
ch4rc0al1080 commented 4 years ago

I found an interesting fact. If I use Alltube website JSON API to get json, the url will be a mp4 file But if I use function getJson() , I will get m3u8 file

Rudloff commented 4 years ago

Hello, Would it be possible to provide a SFW video that reproduces the issue?

M3U8 is not a real video format, it is a playlist format that only contains references to video files located elsewhere. There is usually no point in just downloading the M3U8 file by itself, so if stream mode is enabled, Alltube will fetch the real video stream for you: https://github.com/Rudloff/alltube/blob/acc63a536e72709f8d8043b06652e3a92ddb10bb/controllers/DownloadController.php#L167 So if you want to do the same thing with the library, you probably need to use getM3uStream().

ch4rc0al1080 commented 4 years ago

I will provide the url later, but I think I have fixed how to get a mp4 url -f mp4 is not right. It should be -f 720p

ch4rc0al1080 commented 4 years ago

About providing a SFW video, I just found the problem on pornhub by now...

sam9177 commented 4 years ago

I will provide the url later, but I think I have fixed how to get a mp4 url -f mp4 is not right. It should be -f 720p

Hello, Where to put '-f 720p' to get 720p link? With default settings it shows link to .m3u8

ch4rc0al1080 commented 4 years ago

I will provide the url later, but I think I have fixed how to get a mp4 url -f mp4 is not right. It should be -f 720p

Hello, Where to put '-f 720p' to get 720p link? With default settings it shows link to .m3u8

like this

$video = new Video($url, "720p");
sam9177 commented 4 years ago

I will provide the url later, but I think I have fixed how to get a mp4 url -f mp4 is not right. It should be -f 720p

Hello, Where to put '-f 720p' to get 720p link? With default settings it shows link to .m3u8

like this

$video = new Video($url, "720p");

Thank you, it works.

For youtube-dl I can use '[height<=720]' command. youtube-dl -g -f '[height<=720]' URL This command will give a link no higher than 720p resolution

For example if video have 1080p it will show 720p If 720p -> 720p If 480p -> 480p

How can I use this command or something like this?

ch4rc0al1080 commented 4 years ago

I will provide the url later, but I think I have fixed how to get a mp4 url -f mp4 is not right. It should be -f 720p

Hello, Where to put '-f 720p' to get 720p link? With default settings it shows link to .m3u8

like this

$video = new Video($url, "720p");

Thank you, it works.

For youtube-dl I can use '[height<=720]' command. youtube-dl -g -f '[height<=720]' URL This command will give a link no higher than 720p resolution

For example if video have 1080p it will show 720p If 720p -> 720p If 480p -> 480p

How can I use this command or something like this?

According to the code, I found that you can use $video = new Video($url, "[height<=720]") , because

$video = new Video($url, $format);
$video_url = $video->getUrl();

will run as

youtube-dl -g -f $format $url

May be it will be better if @Rudloff will be so nice to add more information in README

sam9177 commented 4 years ago

Thank you!

Rudloff commented 4 years ago

I am closing this, since it seems you got what you needed.