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

[resolution] - How to show only resolutions #11527

Closed
pishiii9 opened this issue Dec 24, 2016 · 11 comments
Closed

[resolution] - How to show only resolutions #11527

pishiii9 opened this issue Dec 24, 2016 · 11 comments

Comments

@pishiii9
Copy link

@pishiii9 pishiii9 commented Dec 24, 2016

I am trying to show only resolutions like in the screenshot is it possible? if yes , then how?
screenshot_14

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Dec 24, 2016

You'll need to use API. See https://github.com/rg3/youtube-dl#embedding-youtube-dl for a reference.

@yan12125 yan12125 closed this Dec 24, 2016
@pishiii9
Copy link
Author

@pishiii9 pishiii9 commented Dec 24, 2016

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Dec 24, 2016

You'll need to write some Python scripts first and then call them from PHP.

@pishiii9
Copy link
Author

@pishiii9 pishiii9 commented Dec 24, 2016

$cmd_image = 'youtube-dl --get-thumbnail '. escapeshellarg($url);
$process_img = shell_exec($cmd_image);
echo $process_img;
$cmd = 'youtube-dl --get-title '. escapeshellarg($url);
$title = shell_exec($cmd);
echo $title;

I could print the thumbnail and title on my webpage. The only problem is with formats .. Help me to overcome this issue.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Dec 24, 2016

Only resolutions does not provide much sense, so youtube-dl does not provide it. If you really need it, use the python API:

$ python -c "
import youtube_dl

with youtube_dl.YoutubeDL({'quiet': True}) as ydl:
    info = ydl.extract_info('https://www.youtube.com/watch?v=HxIct0i-CcA', download=False)
    for i in info['formats']:
        if i['vcodec'] != 'none':
            print('{0}x{1}'.format(i['width'], i['height']))
"
256x144
256x144
426x240
426x240
640x360
640x360
854x480
854x480
1280x720
1280x720
1920x1080
1920x1080
176x144
320x180
640x360
640x360
1280x720
@pishiii9
Copy link
Author

@pishiii9 pishiii9 commented Dec 31, 2016

Hello @yan12125 Can't i take the data from --dump-json using PHP only and then show resolutions from there?

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jan 1, 2017

Apparently you already know another way to do it ;)

@pishiii9
Copy link
Author

@pishiii9 pishiii9 commented Jan 2, 2017

@yan12125 I am trying to get the exact formats "(multiple - Quality Selection URL)" Like in the screenshot but i got only the below formats. Can you help me with that?
Please Do it with json and php. Or you can call @phihag .
screenshot_18
screenshot_19

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jan 2, 2017

$data = json_decode(`youtube-dl -j test:cctv`, true);
foreach($data['formats'] as $f)
{
    print $f['format'] . "\n";
}

The result is:

meta - multiple (Quality selection URL)
204 - 320x180
460 - 480x270
870 - 640x360
1228 - 1280x720
2048 - 1280x720
@pishiii9
Copy link
Author

@pishiii9 pishiii9 commented Jan 3, 2017

Thanks man @yan12125 My issue has been resolved. can u please have a look at one more issue.
I am getting the ERR when i try to download from Adult websites .. Here is the result i get using "youtube-dl -v [URL] " command.

Can you help me with that?
By the way my ISP has blocked Adult websites.
screenshot_21

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jan 3, 2017

By the way my ISP has blocked Adult websites.

youtube-dl can't escape ISP restrictions automatically. If you can watch them with proxies or VPNs, add --proxy to the command line.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.