mirror of
https://github.com/neosubhamoy/pytubepp.git
synced 2026-02-04 18:22:23 +05:30
Compare commits
4 Commits
v1.0.7-sta
...
v1.0.8-sta
2
.github/workflows/publish.yml
vendored
2
.github/workflows/publish.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
|||||||
- name: 🐍 Setup Python
|
- name: 🐍 Setup Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.12'
|
||||||
|
|
||||||
- name: 📦 Install dependencies
|
- name: 📦 Install dependencies
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
### A Simple CLI Tool to Download Your Favourite YouTube Videos Effortlessly!
|
### A Simple CLI Tool to Download Your Favourite YouTube Videos Effortlessly!
|
||||||
|
|
||||||
[](https://github.com/neosubhamoy/pytubepp/)
|
[](https://github.com/neosubhamoy/pytubepp/)
|
||||||
[](https://github.com/neosubhamoy/pytubepp/)
|
[](https://github.com/neosubhamoy/pytubepp/)
|
||||||
[](https://www.python.org/downloads/)
|
[](https://www.python.org/downloads/)
|
||||||
[](https://github.com/neosubhamoy/pytubepp/)
|
[](https://github.com/neosubhamoy/pytubepp/)
|
||||||
[](https://github.com/neosubhamoy/pytubepp/)
|
[](https://github.com/neosubhamoy/pytubepp/)
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ def set_global_video_info(link):
|
|||||||
if is_valid_url(link):
|
if is_valid_url(link):
|
||||||
global video, author, title, thumbnail, views, stream, stream_resolutions, maxres
|
global video, author, title, thumbnail, views, stream, stream_resolutions, maxres
|
||||||
link = is_valid_url(link).group(1)
|
link = is_valid_url(link).group(1)
|
||||||
video = YouTube(link, 'ANDROID_VR', on_progress_callback=progress)
|
video = YouTube(link, on_progress_callback=progress)
|
||||||
author = video.author
|
author = video.author
|
||||||
title = re.sub(r'[\\/*?:"<>|]', '_', author + ' - ' + video.title)
|
title = re.sub(r'[\\/*?:"<>|]', '_', author + ' - ' + video.title)
|
||||||
thumbnail = video.thumbnail_url
|
thumbnail = video.thumbnail_url
|
||||||
@@ -464,6 +464,7 @@ def show_raw_info(link, prettify=False):
|
|||||||
ado_codec = stream.get_by_itag(140).audio_codec
|
ado_codec = stream.get_by_itag(140).audio_codec
|
||||||
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
||||||
ado_bitrate = stream.get_by_itag(140).abr
|
ado_bitrate = stream.get_by_itag(140).abr
|
||||||
|
is_hdr = True if matching_stream.itag == 702 else False
|
||||||
if res == '2160p':
|
if res == '2160p':
|
||||||
resolution = '2160p'
|
resolution = '2160p'
|
||||||
if stream.get_by_itag(701):
|
if stream.get_by_itag(701):
|
||||||
@@ -475,6 +476,7 @@ def show_raw_info(link, prettify=False):
|
|||||||
ado_codec = stream.get_by_itag(140).audio_codec
|
ado_codec = stream.get_by_itag(140).audio_codec
|
||||||
vdo_bitrate = f"{stream.get_by_itag(701).bitrate / 1024:.0f}kbps"
|
vdo_bitrate = f"{stream.get_by_itag(701).bitrate / 1024:.0f}kbps"
|
||||||
ado_bitrate = stream.get_by_itag(140).abr
|
ado_bitrate = stream.get_by_itag(140).abr
|
||||||
|
is_hdr = True
|
||||||
else:
|
else:
|
||||||
itag = matching_stream.itag
|
itag = matching_stream.itag
|
||||||
type = matching_stream.mime_type
|
type = matching_stream.mime_type
|
||||||
@@ -484,6 +486,7 @@ def show_raw_info(link, prettify=False):
|
|||||||
ado_codec = stream.get_by_itag(251).audio_codec
|
ado_codec = stream.get_by_itag(251).audio_codec
|
||||||
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
||||||
ado_bitrate = stream.get_by_itag(251).abr
|
ado_bitrate = stream.get_by_itag(251).abr
|
||||||
|
is_hdr = False
|
||||||
elif res == '1440p':
|
elif res == '1440p':
|
||||||
resolution = '1440p'
|
resolution = '1440p'
|
||||||
if stream.get_by_itag(700):
|
if stream.get_by_itag(700):
|
||||||
@@ -495,6 +498,7 @@ def show_raw_info(link, prettify=False):
|
|||||||
ado_codec = stream.get_by_itag(140).audio_codec
|
ado_codec = stream.get_by_itag(140).audio_codec
|
||||||
vdo_bitrate = f"{stream.get_by_itag(700).bitrate / 1024:.0f}kbps"
|
vdo_bitrate = f"{stream.get_by_itag(700).bitrate / 1024:.0f}kbps"
|
||||||
ado_bitrate = stream.get_by_itag(140).abr
|
ado_bitrate = stream.get_by_itag(140).abr
|
||||||
|
is_hdr = True
|
||||||
else:
|
else:
|
||||||
itag = matching_stream.itag
|
itag = matching_stream.itag
|
||||||
type = matching_stream.mime_type
|
type = matching_stream.mime_type
|
||||||
@@ -504,6 +508,7 @@ def show_raw_info(link, prettify=False):
|
|||||||
ado_codec = stream.get_by_itag(251).audio_codec
|
ado_codec = stream.get_by_itag(251).audio_codec
|
||||||
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
||||||
ado_bitrate = stream.get_by_itag(251).abr
|
ado_bitrate = stream.get_by_itag(251).abr
|
||||||
|
is_hdr = False
|
||||||
elif res == '1080p':
|
elif res == '1080p':
|
||||||
resolution = '1080p'
|
resolution = '1080p'
|
||||||
if stream.get_by_itag(699):
|
if stream.get_by_itag(699):
|
||||||
@@ -515,6 +520,7 @@ def show_raw_info(link, prettify=False):
|
|||||||
ado_codec = stream.get_by_itag(140).audio_codec
|
ado_codec = stream.get_by_itag(140).audio_codec
|
||||||
vdo_bitrate = f"{stream.get_by_itag(699).bitrate / 1024:.0f}kbps"
|
vdo_bitrate = f"{stream.get_by_itag(699).bitrate / 1024:.0f}kbps"
|
||||||
ado_bitrate = stream.get_by_itag(140).abr
|
ado_bitrate = stream.get_by_itag(140).abr
|
||||||
|
is_hdr = True
|
||||||
else:
|
else:
|
||||||
itag = matching_stream.itag
|
itag = matching_stream.itag
|
||||||
type = matching_stream.mime_type
|
type = matching_stream.mime_type
|
||||||
@@ -524,6 +530,7 @@ def show_raw_info(link, prettify=False):
|
|||||||
ado_codec = stream.get_by_itag(140).audio_codec
|
ado_codec = stream.get_by_itag(140).audio_codec
|
||||||
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
||||||
ado_bitrate = stream.get_by_itag(140).abr
|
ado_bitrate = stream.get_by_itag(140).abr
|
||||||
|
is_hdr = False
|
||||||
elif res == '720p':
|
elif res == '720p':
|
||||||
resolution = '720p'
|
resolution = '720p'
|
||||||
if stream.get_by_itag(698):
|
if stream.get_by_itag(698):
|
||||||
@@ -535,6 +542,7 @@ def show_raw_info(link, prettify=False):
|
|||||||
ado_codec = stream.get_by_itag(140).audio_codec
|
ado_codec = stream.get_by_itag(140).audio_codec
|
||||||
vdo_bitrate = f"{stream.get_by_itag(698).bitrate / 1024:.0f}kbps"
|
vdo_bitrate = f"{stream.get_by_itag(698).bitrate / 1024:.0f}kbps"
|
||||||
ado_bitrate = stream.get_by_itag(140).abr
|
ado_bitrate = stream.get_by_itag(140).abr
|
||||||
|
is_hdr = True
|
||||||
else:
|
else:
|
||||||
itag = matching_stream.itag
|
itag = matching_stream.itag
|
||||||
type = matching_stream.mime_type
|
type = matching_stream.mime_type
|
||||||
@@ -544,6 +552,7 @@ def show_raw_info(link, prettify=False):
|
|||||||
ado_codec = stream.get_by_itag(140).audio_codec
|
ado_codec = stream.get_by_itag(140).audio_codec
|
||||||
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
||||||
ado_bitrate = stream.get_by_itag(140).abr
|
ado_bitrate = stream.get_by_itag(140).abr
|
||||||
|
is_hdr = False
|
||||||
elif res == '480p':
|
elif res == '480p':
|
||||||
itag = matching_stream.itag
|
itag = matching_stream.itag
|
||||||
resolution = '480p'
|
resolution = '480p'
|
||||||
@@ -554,6 +563,7 @@ def show_raw_info(link, prettify=False):
|
|||||||
ado_codec = stream.get_by_itag(140).audio_codec
|
ado_codec = stream.get_by_itag(140).audio_codec
|
||||||
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
||||||
ado_bitrate = stream.get_by_itag(140).abr
|
ado_bitrate = stream.get_by_itag(140).abr
|
||||||
|
is_hdr = False
|
||||||
elif res == '360p':
|
elif res == '360p':
|
||||||
itag = matching_stream.itag
|
itag = matching_stream.itag
|
||||||
resolution = '360p'
|
resolution = '360p'
|
||||||
@@ -564,6 +574,7 @@ def show_raw_info(link, prettify=False):
|
|||||||
ado_codec = matching_stream.audio_codec
|
ado_codec = matching_stream.audio_codec
|
||||||
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
||||||
ado_bitrate = matching_stream.abr
|
ado_bitrate = matching_stream.abr
|
||||||
|
is_hdr = False
|
||||||
elif res in ['240p', '144p']:
|
elif res in ['240p', '144p']:
|
||||||
itag = matching_stream.itag
|
itag = matching_stream.itag
|
||||||
resolution = res
|
resolution = res
|
||||||
@@ -574,6 +585,7 @@ def show_raw_info(link, prettify=False):
|
|||||||
ado_codec = stream.get_by_itag(139).audio_codec
|
ado_codec = stream.get_by_itag(139).audio_codec
|
||||||
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
||||||
ado_bitrate = stream.get_by_itag(139).abr
|
ado_bitrate = stream.get_by_itag(139).abr
|
||||||
|
is_hdr = False
|
||||||
elif res == 'mp3':
|
elif res == 'mp3':
|
||||||
itag = matching_stream.itag
|
itag = matching_stream.itag
|
||||||
resolution = 'mp3'
|
resolution = 'mp3'
|
||||||
@@ -584,6 +596,7 @@ def show_raw_info(link, prettify=False):
|
|||||||
ado_codec = matching_stream.audio_codec
|
ado_codec = matching_stream.audio_codec
|
||||||
vdo_bitrate = None
|
vdo_bitrate = None
|
||||||
ado_bitrate = matching_stream.abr
|
ado_bitrate = matching_stream.abr
|
||||||
|
is_hdr = False
|
||||||
|
|
||||||
else:
|
else:
|
||||||
filesize = "N/A"
|
filesize = "N/A"
|
||||||
@@ -596,7 +609,8 @@ def show_raw_info(link, prettify=False):
|
|||||||
'vcodec': vdo_codec,
|
'vcodec': vdo_codec,
|
||||||
'acodec': ado_codec,
|
'acodec': ado_codec,
|
||||||
'vbitrate': vdo_bitrate,
|
'vbitrate': vdo_bitrate,
|
||||||
'abitrate': ado_bitrate
|
'abitrate': ado_bitrate,
|
||||||
|
'is_hdr': is_hdr
|
||||||
}
|
}
|
||||||
streams_list.append(current_stream)
|
streams_list.append(current_stream)
|
||||||
|
|
||||||
@@ -606,6 +620,7 @@ def show_raw_info(link, prettify=False):
|
|||||||
|
|
||||||
if prettify:
|
if prettify:
|
||||||
print(json.dumps({
|
print(json.dumps({
|
||||||
|
'id': video.video_id,
|
||||||
'title': video.title,
|
'title': video.title,
|
||||||
'author': author,
|
'author': author,
|
||||||
'thumbnail_url': thumbnail,
|
'thumbnail_url': thumbnail,
|
||||||
@@ -616,6 +631,7 @@ def show_raw_info(link, prettify=False):
|
|||||||
}, indent=4))
|
}, indent=4))
|
||||||
else:
|
else:
|
||||||
print(json.dumps({
|
print(json.dumps({
|
||||||
|
'id': video.video_id,
|
||||||
'title': video.title,
|
'title': video.title,
|
||||||
'author': author,
|
'author': author,
|
||||||
'thumbnail_url': thumbnail,
|
'thumbnail_url': thumbnail,
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -6,7 +6,7 @@ with open('README.md', 'r', encoding='utf8') as file:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='pytubepp',
|
name='pytubepp',
|
||||||
version='1.0.7',
|
version='1.0.8',
|
||||||
description='A Simple CLI Tool to Download Your Favorite YouTube Videos Effortlessly!',
|
description='A Simple CLI Tool to Download Your Favorite YouTube Videos Effortlessly!',
|
||||||
long_description=readme,
|
long_description=readme,
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
|
|||||||
Reference in New Issue
Block a user