mirror of
https://github.com/neosubhamoy/pytubepp.git
synced 2026-02-04 10:22:21 +05:30
Compare commits
11 Commits
v1.0.7-sta
...
v1.1.0-sta
2
.github/workflows/publish.yml
vendored
2
.github/workflows/publish.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
||||
- name: 🐍 Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.12'
|
||||
|
||||
- name: 📦 Install dependencies
|
||||
run: |
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
### A Simple CLI Tool to Download Your Favourite YouTube Videos Effortlessly!
|
||||
|
||||
[](https://github.com/neosubhamoy/pytubepp/)
|
||||
[](https://github.com/neosubhamoy/pytubepp/)
|
||||
[](https://www.python.org/downloads/)
|
||||
[](https://pypi.org/project/pytubepp/)
|
||||
[](https://pypi.org/project/pytubepp/)
|
||||
[](https://www.python.org/downloads/)
|
||||
[](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):
|
||||
global video, author, title, thumbnail, views, stream, stream_resolutions, maxres
|
||||
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
|
||||
title = re.sub(r'[\\/*?:"<>|]', '_', author + ' - ' + video.title)
|
||||
thumbnail = video.thumbnail_url
|
||||
@@ -435,7 +435,7 @@ def show_video_info(link):
|
||||
print('Sorry, No video streams found....!!!')
|
||||
sys.exit()
|
||||
|
||||
print(f'\nTitle: {video.title}\nAuthor: {author}\nPublished On: {video.publish_date.strftime('%d/%m/%Y')}\nDuration: {video.length}\nViews: {views}\n')
|
||||
print(f'\nTitle: {video.title}\nAuthor: {author}\nPublished On: {video.publish_date.strftime("%d/%m/%Y")}\nDuration: {video.length}\nViews: {views}\n')
|
||||
print(tabulate(table, headers=['Stream', 'Alias (for -s flag)', 'Format', 'Size', 'FrameRate', 'V-Codec', 'A-Codec', 'V-BitRate', 'A-BitRate']))
|
||||
print('\n')
|
||||
else:
|
||||
@@ -464,10 +464,11 @@ def show_raw_info(link, prettify=False):
|
||||
ado_codec = stream.get_by_itag(140).audio_codec
|
||||
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
||||
ado_bitrate = stream.get_by_itag(140).abr
|
||||
is_hdr = True if matching_stream.itag == 702 else False
|
||||
if res == '2160p':
|
||||
resolution = '2160p'
|
||||
if stream.get_by_itag(701):
|
||||
itag = '701'
|
||||
itag = 701
|
||||
type = stream.get_by_itag(701).mime_type
|
||||
filesize = stream.get_by_itag(701).filesize + stream.get_by_itag(140).filesize
|
||||
fps = stream.get_by_itag(701).fps
|
||||
@@ -475,6 +476,7 @@ def show_raw_info(link, prettify=False):
|
||||
ado_codec = stream.get_by_itag(140).audio_codec
|
||||
vdo_bitrate = f"{stream.get_by_itag(701).bitrate / 1024:.0f}kbps"
|
||||
ado_bitrate = stream.get_by_itag(140).abr
|
||||
is_hdr = True
|
||||
else:
|
||||
itag = matching_stream.itag
|
||||
type = matching_stream.mime_type
|
||||
@@ -484,10 +486,11 @@ def show_raw_info(link, prettify=False):
|
||||
ado_codec = stream.get_by_itag(251).audio_codec
|
||||
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
||||
ado_bitrate = stream.get_by_itag(251).abr
|
||||
is_hdr = False
|
||||
elif res == '1440p':
|
||||
resolution = '1440p'
|
||||
if stream.get_by_itag(700):
|
||||
itag = '700'
|
||||
itag = 700
|
||||
type = stream.get_by_itag(700).mime_type
|
||||
filesize = stream.get_by_itag(700).filesize + stream.get_by_itag(140).filesize
|
||||
fps = stream.get_by_itag(700).fps
|
||||
@@ -495,6 +498,7 @@ def show_raw_info(link, prettify=False):
|
||||
ado_codec = stream.get_by_itag(140).audio_codec
|
||||
vdo_bitrate = f"{stream.get_by_itag(700).bitrate / 1024:.0f}kbps"
|
||||
ado_bitrate = stream.get_by_itag(140).abr
|
||||
is_hdr = True
|
||||
else:
|
||||
itag = matching_stream.itag
|
||||
type = matching_stream.mime_type
|
||||
@@ -504,10 +508,11 @@ def show_raw_info(link, prettify=False):
|
||||
ado_codec = stream.get_by_itag(251).audio_codec
|
||||
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
||||
ado_bitrate = stream.get_by_itag(251).abr
|
||||
is_hdr = False
|
||||
elif res == '1080p':
|
||||
resolution = '1080p'
|
||||
if stream.get_by_itag(699):
|
||||
itag = '699'
|
||||
itag = 699
|
||||
type = stream.get_by_itag(699).mime_type
|
||||
filesize = stream.get_by_itag(699).filesize + stream.get_by_itag(140).filesize
|
||||
fps = stream.get_by_itag(699).fps
|
||||
@@ -515,6 +520,7 @@ def show_raw_info(link, prettify=False):
|
||||
ado_codec = stream.get_by_itag(140).audio_codec
|
||||
vdo_bitrate = f"{stream.get_by_itag(699).bitrate / 1024:.0f}kbps"
|
||||
ado_bitrate = stream.get_by_itag(140).abr
|
||||
is_hdr = True
|
||||
else:
|
||||
itag = matching_stream.itag
|
||||
type = matching_stream.mime_type
|
||||
@@ -524,10 +530,11 @@ def show_raw_info(link, prettify=False):
|
||||
ado_codec = stream.get_by_itag(140).audio_codec
|
||||
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
||||
ado_bitrate = stream.get_by_itag(140).abr
|
||||
is_hdr = False
|
||||
elif res == '720p':
|
||||
resolution = '720p'
|
||||
if stream.get_by_itag(698):
|
||||
itag = '698'
|
||||
itag = 698
|
||||
type = stream.get_by_itag(698).mime_type
|
||||
filesize = stream.get_by_itag(698).filesize + stream.get_by_itag(140).filesize
|
||||
fps = stream.get_by_itag(698).fps
|
||||
@@ -535,6 +542,7 @@ def show_raw_info(link, prettify=False):
|
||||
ado_codec = stream.get_by_itag(140).audio_codec
|
||||
vdo_bitrate = f"{stream.get_by_itag(698).bitrate / 1024:.0f}kbps"
|
||||
ado_bitrate = stream.get_by_itag(140).abr
|
||||
is_hdr = True
|
||||
else:
|
||||
itag = matching_stream.itag
|
||||
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
|
||||
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
||||
ado_bitrate = stream.get_by_itag(140).abr
|
||||
is_hdr = False
|
||||
elif res == '480p':
|
||||
itag = matching_stream.itag
|
||||
resolution = '480p'
|
||||
@@ -554,6 +563,7 @@ def show_raw_info(link, prettify=False):
|
||||
ado_codec = stream.get_by_itag(140).audio_codec
|
||||
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
||||
ado_bitrate = stream.get_by_itag(140).abr
|
||||
is_hdr = False
|
||||
elif res == '360p':
|
||||
itag = matching_stream.itag
|
||||
resolution = '360p'
|
||||
@@ -564,6 +574,7 @@ def show_raw_info(link, prettify=False):
|
||||
ado_codec = matching_stream.audio_codec
|
||||
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
||||
ado_bitrate = matching_stream.abr
|
||||
is_hdr = False
|
||||
elif res in ['240p', '144p']:
|
||||
itag = matching_stream.itag
|
||||
resolution = res
|
||||
@@ -574,6 +585,7 @@ def show_raw_info(link, prettify=False):
|
||||
ado_codec = stream.get_by_itag(139).audio_codec
|
||||
vdo_bitrate = f"{matching_stream.bitrate / 1024:.0f}kbps"
|
||||
ado_bitrate = stream.get_by_itag(139).abr
|
||||
is_hdr = False
|
||||
elif res == 'mp3':
|
||||
itag = matching_stream.itag
|
||||
resolution = 'mp3'
|
||||
@@ -584,6 +596,7 @@ def show_raw_info(link, prettify=False):
|
||||
ado_codec = matching_stream.audio_codec
|
||||
vdo_bitrate = None
|
||||
ado_bitrate = matching_stream.abr
|
||||
is_hdr = False
|
||||
|
||||
else:
|
||||
filesize = "N/A"
|
||||
@@ -596,7 +609,8 @@ def show_raw_info(link, prettify=False):
|
||||
'vcodec': vdo_codec,
|
||||
'acodec': ado_codec,
|
||||
'vbitrate': vdo_bitrate,
|
||||
'abitrate': ado_bitrate
|
||||
'abitrate': ado_bitrate,
|
||||
'is_hdr': is_hdr
|
||||
}
|
||||
streams_list.append(current_stream)
|
||||
|
||||
@@ -606,6 +620,7 @@ def show_raw_info(link, prettify=False):
|
||||
|
||||
if prettify:
|
||||
print(json.dumps({
|
||||
'id': video.video_id,
|
||||
'title': video.title,
|
||||
'author': author,
|
||||
'thumbnail_url': thumbnail,
|
||||
@@ -616,6 +631,7 @@ def show_raw_info(link, prettify=False):
|
||||
}, indent=4))
|
||||
else:
|
||||
print(json.dumps({
|
||||
'id': video.video_id,
|
||||
'title': video.title,
|
||||
'author': author,
|
||||
'thumbnail_url': thumbnail,
|
||||
@@ -726,7 +742,7 @@ def download_stream(link, chosen_stream):
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=f'pytubePP (Pytube Post Processor) v{version} - A Simple CLI Tool to Download Your Favorite YouTube Videos Effortlessly!')
|
||||
parser = argparse.ArgumentParser(description=f'PytubePP (Pytube Post Processor) v{version} - A Simple CLI Tool to Download Your Favorite YouTube Videos Effortlessly!')
|
||||
parser.add_argument('url', nargs='?', default=None, help='url of the youtube video')
|
||||
parser.add_argument('-df', '--download-folder', default=argparse.SUPPRESS, help='set custom download folder path (default: ~/Downloads/Pytube Downloads) [arg eg: "/path/to/folder"]')
|
||||
parser.add_argument('-ds', '--default-stream', default=argparse.SUPPRESS, help='set default download stream (default: max) [available arguments: 144p, 240p, 360p, 480p, 720p, 1080p, 1440p, 2160p, 4320p, mp3, max]')
|
||||
|
||||
2
setup.py
2
setup.py
@@ -6,7 +6,7 @@ with open('README.md', 'r', encoding='utf8') as file:
|
||||
|
||||
setup(
|
||||
name='pytubepp',
|
||||
version='1.0.7',
|
||||
version='1.1.0',
|
||||
description='A Simple CLI Tool to Download Your Favorite YouTube Videos Effortlessly!',
|
||||
long_description=readme,
|
||||
long_description_content_type='text/markdown',
|
||||
|
||||
Reference in New Issue
Block a user