Giter Site home page Giter Site logo

Comments (37)

norkunas avatar norkunas commented on May 29, 2024 1

Hello,

If you don't need to list any other information then don't list 😅 basically all information is parsed from JSON and it's parsing is fast.

from youtube-dl-php.

norkunas avatar norkunas commented on May 29, 2024 1

Probably you'll need to find some proxy then which is not blocked by viu.com

from youtube-dl-php.

norkunas avatar norkunas commented on May 29, 2024 1

yes, you could make a pull request, that would be awesome :)

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

hello .
any suggesrtion ? :)

Thanks

from youtube-dl-php.

norkunas avatar norkunas commented on May 29, 2024

Hello, sorry for late reply.
Are you using youtube-dl binary for windows in an unix environment?

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

Hi

Yes . I am using php version 7.2 in ubuntu Linux .

from youtube-dl-php.

norkunas avatar norkunas commented on May 29, 2024

Then you need to download youtube-dl for linux :) https://rg3.github.io/youtube-dl/download.html

sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

And then set $yt->setBinPath('/usr/local/bin/youtube-dl');

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

Thanks It is working like charm .
And also where can I set new options and halt other default options .

Thanks .

from youtube-dl-php.

norkunas avatar norkunas commented on May 29, 2024

If you need to use the library based on other options, just instantiate a different instances, for example:

$videoYt = new YoutubeDl([
    'format' => 'bestvideo',
]);
$video = $videoYt->download('url');

$audioYt = new YoutubeDl([
    'extract-audio' => true,
    'audio-format' => 'mp3',
]);
$audio = $audioYt->download('url');

and that's all. :)

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

:)
setting up this options only will halt other downloading default options ? Because I don't want the command programme to download it each and every time it run .

from youtube-dl-php.

norkunas avatar norkunas commented on May 29, 2024

Sorry, could you be more clear? Because I don't understand know what do you want to do 🤔

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

I only need subtitles , no audio , videos etc and also no downloads :)

from youtube-dl-php.

norkunas avatar norkunas commented on May 29, 2024

We talked about this in #72 (comment) you said it's working :)

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

Cool .Yes it is working great. But if I only need to list subs . Actually it is downloading subtitles . If I want to skip download . Can I ?

from youtube-dl-php.

norkunas avatar norkunas commented on May 29, 2024

I don't think so as I don't see that youtube-dl itself would support this.

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

Hi ,

Thanks for the help you did .
I need some suggestion here .
I only want the to list all the available subtitles and no listing of videos format , audios etc .
& how can i speed up the listing using your library ( do i need to add some options ? ) .

Hope you understand what i need . any help is much appreciable .
Thanks .

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

😄 cool .

And one More thing

  1. how to set sub format option as srt , If listing subtitles .
  2. can we make automatic captions using subtitles i.e , If I am translating English to French or English to Chinese .
    That's it .

Thanks .

from youtube-dl-php.

norkunas avatar norkunas commented on May 29, 2024

To be clear, this library is mostly created to ease setuping for downloading url -> video or url -> audio.
If you don't need any of this functionality, I suggest you to use youtube-dl binary directly in php,
or decorate this library with your own class and add subtitles listing helper method like getExtractorsList.
There is a --list-subs and --sub-format options, so your helper could look like:

public function getSubtitlesList(string $url): array
{
    $process = $this->createProcess([$url, '--list-subs', 'sub-format=srt']);
    $process->mustRun(is_callable($this->debug) ? $this->debug : null);

    // do something with $process->getOutput()..
}

So this would let you to get subtitles in srt format.

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

hello ,
added the getSubtitlesList( ) in your library .
the response is no subtitles at all only the formats . can i make the subtitles using these
options( 'skip-download', 'all-subs' ,'list-subs','write-sub','write-auto-sub' , 'sub-format', 'sub-lang' ) .
so to get the max. available subtitles
I have used the youtube-dl $yt = new YoutubeDl( ) to call this method & the response is no subtitles only the formats .
[0] => [viki] 1119776v: Downloading video JSON
[1] => [viki] 1119776v: Downloading video streams JSON
[2] => Available subtitles for 1119776v:
[3] => Language formats
[4] => tr vtt, srt
[5] => pt vtt, srt
[6] => en vtt, srt
[7] => ar vtt, srt
[8] => fr vtt, srt
[9] => es vtt, srt
[10] => de vtt, srt

from youtube-dl-php.

norkunas avatar norkunas commented on May 29, 2024

Ok, so now it's more clear to me what do you want :) then that method is useless for you.
I've tested https://www.youtube.com/watch?v=Ye8mB6VsUHw with these options:
skip-download, all-subs and the output I've got:

      ["subtitles"]=>
      array(1) {
        ["en"]=>
        object(YoutubeDl\Entity\Subtitles)#4 (1) {
          ["elements":protected]=>
          array(2) {
            [0]=>
            array(2) {
              ["url"]=>
              string(74) "https://www.youtube.com/api/timedtext?lang=en&fmt=ttml&name=&v=Ye8mB6VsUHw"
              ["ext"]=>
              string(4) "ttml"
            }
            [1]=>
            array(2) {
              ["url"]=>
              string(73) "https://www.youtube.com/api/timedtext?lang=en&fmt=vtt&name=&v=Ye8mB6VsUHw"
              ["ext"]=>
              string(3) "vtt"
            }
          }
        }
      }

Is this want you want? Having this format you can get the subtitles from the retrieved URL's.
Also tried with --sub-format srt and then if video doesn't have srt format of subtitles then yt-dl will download another format:
WARNING: No subtitle format found matching "srt" for language en, using vtt
So if you want to parse the subtitles then I'd suggest you to write parsers for any format.

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

Hello ,
Yes exactly this is what i want. I am using it like this .
$yt = new YoutubeDl([
// 'skip-download' => true,
// 'all-subs' => true,
// 'list-subs' => true,
// 'write-sub' => true,
// 'write-auto-sub' => true,
// 'sub-format' => 'string',
// 'sub-lang' => 'string',
]);
$video = $yt->download($url);
basically these options setup gives me result for the subtitles & the automatic captions .
But i want to remove that extra data and speed en up the process .
What best i can do .

Thanks .

from youtube-dl-php.

norkunas avatar norkunas commented on May 29, 2024

It's impossible to provide to the youtube-dl binary what fields do you need. So when you get the $video just ead the subtitles and ignore other context, as I said earlier it's already fast, you wouldn't notice any difference in speed if other fields wouldn't be denormalized to video model.

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

Thanks .
Yes setting these options gives me all list of subtitles etc and that means the script is okay in my previous comment .No need to change now . And one more thing . Do this library converts ISO lang codes to language name .

from youtube-dl-php.

norkunas avatar norkunas commented on May 29, 2024

I don't think so, but you can use Intl.

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

Thank you again 😊 .
And what about the script ?
Options setting for class YouTube dl .
It is okay ?

from youtube-dl-php.

norkunas avatar norkunas commented on May 29, 2024

@garry911 it looks good to me, except the list-subs, it does the discussed thing in #73 (comment)

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

Hello .

If i wants to use few more options . where should i add new options .
As i get this error
" The options "convert-subtitles srt", "sub-format ttml" do not exist. " .

After adding " 'sub-format ttml' => 'string',
'convert-subtitles srt' => 'string', "

these options in this section .
$yt = new YoutubeDl([
// 'skip-download' => true,
// 'all-subs' => true,
// 'list-subs' => true,
// 'write-sub' => true,
// 'write-auto-sub' => true,
// 'sub-format' => 'string',
// 'sub-lang' => 'string',
]);

Thanks .

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

Hi,
This is working great. Thanks.
But I have some video that " Failed to download " due LC_ALL environment variable and the error is

WARNING: Assuming --restrict-filenames since file system encoding cannot encode all characters. Set the LC_ALL environment variable to fix this. ERROR: This video is not available in your region.

Is there any thing i can set " LC_ALL " env variable using this repository,

Thanks.

from youtube-dl-php.

norkunas avatar norkunas commented on May 29, 2024

Hey, this is a php function and is not related to this library at all, please try it.

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

Hey, Do you have any solution for this Error?
I am failing in executing these videos url. Hope you know some :)

Failed to download: The command "'youtube-dl' 'https://www.viu.com/ott/ph/en-us/vod/42352/Chief%20Kim' '--no-playlist' '--ignore-config' '--write-info-json' '--skip-download' '--write-sub' '--write-auto-sub' '--socket-timeout=2' '--sub-lang=string' '--restrict-filenames'" failed. Exit Code: 1(General error) Working directory: /var/www/html/apps/coresub/public/downloads Output: ================ [viu:ott] 42352: Downloading video info Error Output: ================ ERROR: This video is not available in your region.

from youtube-dl-php.

norkunas avatar norkunas commented on May 29, 2024

Hey @garry911, does it work if you call that command directly in console? If not could you check if that works with some of these options:

--geo-verification-proxy URL     Use this proxy to verify the IP address for
                                 some geo-restricted sites. The default
                                 proxy specified by --proxy (or none, if the
                                 option is not present) is used for the
                                 actual downloading.
--geo-bypass                     Bypass geographic restriction via faking
                                 X-Forwarded-For HTTP header
--no-geo-bypass                  Do not bypass geographic restriction via
                                 faking X-Forwarded-For HTTP header
--geo-bypass-country CODE        Force bypass geographic restriction with
                                 explicitly provided two-letter ISO 3166-2
                                 country code
--geo-bypass-ip-block IP_BLOCK   Force bypass geographic restriction with
                                 explicitly provided IP block in CIDR
                                 notation

Because as the error says it's not available in your region, so it's the geo restriction IIUC.

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

No, running command in console shows me the same error.
ERROR: This video is not available in your region.

I have tried adding these options like this. \Before that i have added these options YoutubeDl.php file.
Things seems not working and the error is same. What URL, CODE and IP_BLOCK can i use to remove these warnings.

$yt = new YoutubeDl([
'skip-download' => true,
'geo-verification-proxy' => 'string',
'geo-bypass' => 'string',
'geo-bypass-country' =>
])

can you please tell me the ryt format to use these option Or any Example.

from youtube-dl-php.

norkunas avatar norkunas commented on May 29, 2024

@garry911 did you try the console command with appending the --geo-bypass option?

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

Yes the result was same. Video not available in your region.

from youtube-dl-php.

norkunas avatar norkunas commented on May 29, 2024

Then sorry because I don't have any suggestions 😞

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

Okay. Could you please tell me the right way to do this with correct syntax. As I am getting the error like these option not found. Some other predefined options are found. I think I need to add the not found options in your repository somewhere in YouTube-dl.php.

from youtube-dl-php.

garry911 avatar garry911 commented on May 29, 2024

Thanks. I will

from youtube-dl-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.