0% found this document useful (0 votes)
12 views4 pages

Python Code for YouTube Download & SQLite

Uploaded by

Sudershan Thaiba
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views4 pages

Python Code for YouTube Download & SQLite

Uploaded by

Sudershan Thaiba
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

x=1

y=2

print ('x is equal to y: %s' % (x == y))

z=1

print ('x is equal to z: %s' % (x == z))

names = ['Donald', 'Jake', 'Phil']

words = ['Random', 'Words', 'Dogs']

if names == words:

print ('Names list is equal to words')

else:

print ("Names list isn't equal to words")

new_names = ['Donald', 'Jake', 'Phil']

print ('New names list is equal to names: %s' % (new_names == names))

squares = {x**2 for x in [0,2,4] if x < 4}

print(squares)

# {0, 4}
from pytube import YouTube

#ask for the link from user

link = input("Enter the link of YouTube video you want to download: ")

yt = YouTube(link)

#Showing details

print("Title: ",[Link])

print("Number of views: ",[Link])

print("Length of video: ",[Link])

print("Rating of video: ",[Link])

#Getting the highest resolution possible

ys = [Link].get_highest_resolution()

#Starting download

print("Downloading...")

[Link]()

print("Download completed!!")
import sqlite3

conn = [Link]('[Link]')

c = [Link]()

# Create table

[Link]('Drop Table stocks')

# Create table

[Link]('''CREATE TABLE stocks

(date text, trans text, symbol text, qty real, price real)''')

# Insert a row of data

[Link]("INSERT INTO stocks VALUES ('2006-01-05','BUY','RHAT',100,35.14)")

# Save (commit) the changes

[Link]()

# Never do this -- insecure!

symbol = 'RHAT'

[Link]("SELECT * FROM stocks WHERE symbol = '%s'" % symbol)

# Do this instead

t = ('RHAT',)

[Link]('SELECT * FROM stocks WHERE symbol=?', t)

print ([Link]()) ##error


print("|End")

# Larger example that inserts many records at a time

purchases = [('2006-03-28', 'BUY', 'IBM', 1000, 45.00),

('2006-04-05', 'BUY', 'MSFT', 1000, 72.00),

('2006-04-06', 'SELL', 'IBM', 500, 53.00),

[Link]('INSERT INTO stocks VALUES (?,?,?,?,?)', purchases)

# Save (commit) the changes

[Link]()

for row in [Link]('SELECT * FROM stocks ORDER BY price'):

print (row)

# We can also close the connection if we are done with it.

# Just be sure any changes have been committed or they will be lost.

[Link]()

print("|End")

You might also like