๐ฅ 5 useful Python automation scripts
1. Download Youtube videos
2. Automate WhatsApp messages
3. Google search with Python
4. Download Instagram posts
5. Extract audio from video files
1. Download Youtube videos
pip install pytube
from pytube import YouTube
# Specify the URL of the YouTube video
video_url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
# Create a YouTube object
yt = YouTube(video_url)
# Select the highest resolution stream
stream = yt.streams.get_highest_resolution()
# Define the output path for the downloaded video
output_path = "path/to/output/directory/"
# Download the video
stream.download(output_path)
print("Video downloaded successfully!")
2. Automate WhatsApp messages
pip install pywhatkit
import pywhatkit
# Set the target phone number (with country code) and the message
phone_number = "+1234567890"
message = "Hello, this is an automated WhatsApp message!"
# Schedule the message to be sent at a specific time (24-hour format)
hour = 13
minute = 30
# Send the scheduled message
pywhatkit.sendwhatmsg(phone_number, message, hour, minute)
3. Google search with Python
pip install googlesearch-python
from googlesearch import search
# Define the query you want to search
query = "Python programming"
# Specify the number of search results you want to retrieve
num_results = 5
# Perform the search and retrieve the results
search_results = search(query, num_results=num_results, lang='en')
# Print the search results
for result in search_results:
print(result)
4. Download Instagram posts
pip install instaloader
import instaloader
# Create an instance of Instaloader
loader = instaloader.Instaloader()
# Define the target Instagram profile
target_profile = "instagram"
# Download posts from the profile
loader.download_profile(target_profile, profile_pic=False, fast_update=True)
print("Posts downloaded successfully!")
5. Extract audio from video files
pip install moviepy
from moviepy.editor import VideoFileClip
# Define the path to the video file
video_path = "path/to/video/file.mp4"
# Create a VideoFileClip object
video_clip = VideoFileClip(video_path)
# Extract the audio from the video
audio_clip = video_clip.audio
# Define the output audio file path
output_audio_path = "path/to/output/audio/file.mp3"
# Write the audio to the output file
audio_clip.write_audiofile(output_audio_path)
# Close the clips
video_clip.close()
audio_clip.close()
print("Audio extracted successfully!")
๐19โค9๐ฅ3๐ฅฐ2
๐3
Seven fun facts about Python that might impress your colleagues:
1. Python was named after Monty Python: The languageโs creator, Guido van Rossum, was a big fan of the British comedy group Monty Python, and he named the language after them.
2. Python is one of the fastest-growing programming languages: According to the TIOBE Index, Python has been one of the fastest-growing programming languages for the past few years, and itโs currently the third most popular language in the world.
3. Python is used by major tech companies: Python is used by many major tech companies, including Google, Dropbox, and Instagram. Itโs also the primary language used by many data science and machine learning teams.
4. Python is easy to learn: Python is known for its simplicity and readability, which makes it easy to learn even for beginners.
5. Python has a large community: Python has a large and active community of developers who create libraries, frameworks, and tools to make programming easier and more efficient.
6. Python is versatile: Python can be used for a wide range of applications, including web development, data analysis, machine learning, automation, and more.
7. Python is open source: Python is an open-source language, which means that itโs free to use and anyone can contribute to its development.
1. Python was named after Monty Python: The languageโs creator, Guido van Rossum, was a big fan of the British comedy group Monty Python, and he named the language after them.
2. Python is one of the fastest-growing programming languages: According to the TIOBE Index, Python has been one of the fastest-growing programming languages for the past few years, and itโs currently the third most popular language in the world.
3. Python is used by major tech companies: Python is used by many major tech companies, including Google, Dropbox, and Instagram. Itโs also the primary language used by many data science and machine learning teams.
4. Python is easy to learn: Python is known for its simplicity and readability, which makes it easy to learn even for beginners.
5. Python has a large community: Python has a large and active community of developers who create libraries, frameworks, and tools to make programming easier and more efficient.
6. Python is versatile: Python can be used for a wide range of applications, including web development, data analysis, machine learning, automation, and more.
7. Python is open source: Python is an open-source language, which means that itโs free to use and anyone can contribute to its development.
๐7โค1
Forwarded from Web Development
5 Steps to Learn Front-End Development๐
Step 1: Basics
โ Internet
โ HTTP
โ Browser
โ Domain & Hosting
Step 2: HTML
โ Basic Tags
โ Semantic HTML
โ Forms & Table
Step 3: CSS
โ Basics
โ CSS Selectors
โ Creating Layouts
โ Flexbox
โ Grid
โ Position - Relative & Absolute
โ Box Model
โ Responsive Web Design
Step 3: JavaScript
โ Basics Syntax
โ Loops
โ Functions
โ Data Types & Object
โ DOM selectors
โ DOM Manipulation
โ JS Module - Export & Import
โ Spread & Rest Operator
โ Asynchronous JavaScript
โ Fetching API
โ Event Loop
โ Prototype
โ ES6 Features
Step 4: Git and GitHub
โ Basics
โ Fork
โ Repository
โ Pull Repo
โ Push Repo
โ Locally Work With Git
Step 5: React
โ Components & JSX
โ List & Keys
โ Props & State
โ Events
โ useState Hook
โ CSS Module
โ React Router
โ Tailwind CSS
Now apply for the job. All the best ๐
Step 1: Basics
โ Internet
โ HTTP
โ Browser
โ Domain & Hosting
Step 2: HTML
โ Basic Tags
โ Semantic HTML
โ Forms & Table
Step 3: CSS
โ Basics
โ CSS Selectors
โ Creating Layouts
โ Flexbox
โ Grid
โ Position - Relative & Absolute
โ Box Model
โ Responsive Web Design
Step 3: JavaScript
โ Basics Syntax
โ Loops
โ Functions
โ Data Types & Object
โ DOM selectors
โ DOM Manipulation
โ JS Module - Export & Import
โ Spread & Rest Operator
โ Asynchronous JavaScript
โ Fetching API
โ Event Loop
โ Prototype
โ ES6 Features
Step 4: Git and GitHub
โ Basics
โ Fork
โ Repository
โ Pull Repo
โ Push Repo
โ Locally Work With Git
Step 5: React
โ Components & JSX
โ List & Keys
โ Props & State
โ Events
โ useState Hook
โ CSS Module
โ React Router
โ Tailwind CSS
Now apply for the job. All the best ๐
๐17โค5๐ฅ1
COMMON TERMINOLOGIES IN PYTHON - PART 1
Have you ever gotten into a discussion with a programmer before? Did you find some of the Terminologies mentioned strange or you didn't fully understand them?
In this series, we would be looking at the common Terminologies in python.
It is important to know these Terminologies to be able to professionally/properly explain your codes to people and/or to be able to understand what people say in an instant when these codes are mentioned. Below are a few:
IDLE (Integrated Development and Learning Environment) - this is an environment that allows you to easily write Python code. IDLE can be used to execute a single statements and create, modify, and execute Python scripts.
Python Shell - This is the interactive environment that allows you to type in python code and execute them immediately
System Python - This is the version of python that comes with your operating system
Prompt - usually represented by the symbol ">>>" and it simply means that python is waiting for you to give it some instructions
REPL (Read-Evaluate-Print-Loop) - this refers to the sequence of events in your interactive window in form of a loop (python reads the code inputted>the code is evaluated>output is printed)
Argument - this is a value that is passed to a function when called eg print("Hello World")... "Hello World" is the argument that is being passed.
Function - this is a code that takes some input, known as arguments, processes that input and produces an output called a return value. E.g print("Hello World")... print is the function
Return Value - this is the value that a function returns to the calling script or function when it completes its task (in other words, Output). E.g.
>>> print("Hello World")
Hello World
Where Hello World is your return value.
Note: A return value can be any of these variable types: handle, integer, object, or string
Script - This is a file where you store your python code in a text file and execute all of the code with a single command
Script files - this is a file containing a group of python scripts
Have you ever gotten into a discussion with a programmer before? Did you find some of the Terminologies mentioned strange or you didn't fully understand them?
In this series, we would be looking at the common Terminologies in python.
It is important to know these Terminologies to be able to professionally/properly explain your codes to people and/or to be able to understand what people say in an instant when these codes are mentioned. Below are a few:
IDLE (Integrated Development and Learning Environment) - this is an environment that allows you to easily write Python code. IDLE can be used to execute a single statements and create, modify, and execute Python scripts.
Python Shell - This is the interactive environment that allows you to type in python code and execute them immediately
System Python - This is the version of python that comes with your operating system
Prompt - usually represented by the symbol ">>>" and it simply means that python is waiting for you to give it some instructions
REPL (Read-Evaluate-Print-Loop) - this refers to the sequence of events in your interactive window in form of a loop (python reads the code inputted>the code is evaluated>output is printed)
Argument - this is a value that is passed to a function when called eg print("Hello World")... "Hello World" is the argument that is being passed.
Function - this is a code that takes some input, known as arguments, processes that input and produces an output called a return value. E.g print("Hello World")... print is the function
Return Value - this is the value that a function returns to the calling script or function when it completes its task (in other words, Output). E.g.
>>> print("Hello World")
Hello World
Where Hello World is your return value.
Note: A return value can be any of these variable types: handle, integer, object, or string
Script - This is a file where you store your python code in a text file and execute all of the code with a single command
Script files - this is a file containing a group of python scripts
๐8