Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Premium Land with House for Sale
anil1961
Updated:
Yesterday at 10:15 AM
AWS Certified Solutions Architect-Associate + AWS Certified Cloud Practitioner
Sanjeewani95
Updated:
Wednesday at 8:16 PM
🚀 එක පැකේජ් එකයි - මාසෙටම Unlimited Internet! 🌐
sayuru bandara
Updated:
Tuesday at 10:57 AM
🎬 CapCut Pro 1 Month Access! LKR 600
sayuru bandara
Updated:
Tuesday at 10:55 AM
🚀 Google One AI PRO Plan (Gemini Pro Activation) – 18 Months Access! LKR 2200
sayuru bandara
Updated:
Tuesday at 10:53 AM
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
කෘතීම බුද්ධි යුගයේ මහා පිපිරීමක්
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="garfieldzz" data-source="post: 28683119" data-attributes="member: 510323"><p>මහන්සි වෙලා පැයකින් විතර ගොඩ දාගත්තා<img src="/styles/default/xenforo/smilies/default/D.gif" class="smilie" loading="lazy" alt=":D" title="Big grin :D" data-shortname=":D" /> මම නැත්නම් ඌ ලියයි<img src="/styles/default/xenforo/smilies/default/P.gif" class="smilie" loading="lazy" alt=":P" title=":P :P" data-shortname=":P" /></p><p>!pip install pytube</p><p>from pytube import YouTube</p><p>import os</p><p># Set the URL of the YouTube video</p><p>url = '[MEDIA=youtube]tL__UnFk7fQ[/MEDIA]'</p><p>video = YouTube(url)</p><p># Get the audio streams of the video</p><p>audio_streams = video.streams.filter(only_audio=True)</p><p># Select the first audio stream with the MIME type of "audio/webm"</p><p>audio_stream = next((stream for stream in audio_streams if stream.mime_type == 'audio/webm'), None)</p><p># If no audio stream with the MIME type of "audio/webm" is found, select the first audio stream with the MIME type of "audio/mp4"</p><p>if audio_stream is None:</p><p> audio_stream = next((stream for stream in audio_streams if stream.mime_type == 'audio/mp4'), None)</p><p># If no audio stream is found, raise an error</p><p>if audio_stream is None:</p><p> raise ValueError('No audio streams found')</p><p># Download the audio stream as a webm file</p><p>audio_filename = video.title + '.webm'</p><p>audio_stream.download(output_path='/content/drive/MyDrive/Classroom', filename=audio_filename)</p><p># Convert the webm file to an mp3 file with the same filename</p><p>mp3_filename = video.title + '.mp3'</p><p>os.system(f'ffmpeg -i "/content/drive/MyDrive/Classroom/{audio_filename}" "/content/drive/MyDrive/Classroom/{mp3_filename}"')</p><p># Print the filenames of the downloaded and converted files</p><p>print(f"Downloaded audio file: {audio_filename}")</p><p>print(f"Converted mp3 file: {mp3_filename}")</p></blockquote><p></p>
[QUOTE="garfieldzz, post: 28683119, member: 510323"] මහන්සි වෙලා පැයකින් විතර ගොඩ දාගත්තා:D මම නැත්නම් ඌ ලියයි:P !pip install pytube from pytube import YouTube import os # Set the URL of the YouTube video url = '[MEDIA=youtube]tL__UnFk7fQ[/MEDIA]' video = YouTube(url) # Get the audio streams of the video audio_streams = video.streams.filter(only_audio=True) # Select the first audio stream with the MIME type of "audio/webm" audio_stream = next((stream for stream in audio_streams if stream.mime_type == 'audio/webm'), None) # If no audio stream with the MIME type of "audio/webm" is found, select the first audio stream with the MIME type of "audio/mp4" if audio_stream is None: audio_stream = next((stream for stream in audio_streams if stream.mime_type == 'audio/mp4'), None) # If no audio stream is found, raise an error if audio_stream is None: raise ValueError('No audio streams found') # Download the audio stream as a webm file audio_filename = video.title + '.webm' audio_stream.download(output_path='/content/drive/MyDrive/Classroom', filename=audio_filename) # Convert the webm file to an mp3 file with the same filename mp3_filename = video.title + '.mp3' os.system(f'ffmpeg -i "/content/drive/MyDrive/Classroom/{audio_filename}" "/content/drive/MyDrive/Classroom/{mp3_filename}"') # Print the filenames of the downloaded and converted files print(f"Downloaded audio file: {audio_filename}") print(f"Converted mp3 file: {mp3_filename}") [/QUOTE]
Insert quotes…
Verification
Awruddata maasa keeyada?
Post reply
Top
Bottom