Youtube Cite Version 1.5 Source Code | Citation Generator
- Brian Clark

- Aug 24, 2022
- 2 min read
I thought it would be a good idea to post the python 3.10 source code to my new program for those who don't want to download the .exe file. You will have to install the modules before attempting to run this program.
Here is the link to the previous post I created that shows the steps on how to complete this step.
#Type in pip install and then the module names below:
from calendar import c
import pprint as pp
import re
from tkinter import Y
from bs4 import BeautifulSoup
import requests
import sqlite3
import os.path
import keyboard
#_______________________________________________________
# Wrapping a loop around the program so it can run again.
while True:
print('''
Author: Brian C.
Website: https: // brianclark88.wixsite.com/mysite
Description: The program scrapes youtube for APA7 citation puts into notepad.
Date: 8/19/2022
References: Pythoncode https: // www.thepythoncode.com/article/get-youtube-data-python
Crummy(2022) Beautiful Soup Documentation.Crummy. https: // www.crummy.com/software/BeautifulSoup/bs4/doc/\n\n
Donate only if you can: Cashapp: $TcfTradingGroupLLC | Venmo: @ Brian-Clark-386 | Paypal: https: // paypal.me/tcftrading?country.x=US & locale.x=en_US
Instructions: Cut the youtube link and right click once in the space provided to paste the link, the output will show up in notepad file.
''')
page = requests.get(input("____________________\n \nYouTube Cite Version 1.4 \n____________________\n\n Paste Youtube Url :"))
soup = BeautifulSoup(page.content, "html.parser")
#_________________________________________________________________
FIND THE HTML ELEMENT AND STORE IT IN A VARIABLE
#_________________________________________________________________
channel_name = soup.find("span", itemprop="author").next.next['content']
result = soup.find("meta", itemprop="datePublished")['content']
channel_title = soup.title.string
channel_title_two = soup.find("meta", itemprop="name")["content"]
channel_url = soup.find("span", itemprop="author").next['href']
website = "YouTube"
#_________________________________________________________________
#_______________OPEN OUPUT TEXT FILE & PASTE IN DATA______________
#_________________________________________________________________
def do_this():
text_file = open("output.txt", "a")
text_file.write(channel_name+". ("+result+"). " +
channel_title_two+". "+website+". "+channel_url+".\n\n\n")
# ____Function call______
do_this()
#open file
os.system("output.txt")
#https://www.youtube.com/watch?v=WHaPQoxFVYQend_program = input("\n\nPress Any Key to end program")
#___________Choose to end program or continue the program_______
_______________________________________________________________________
cont = input("\n\nWould You like to end the program y/n?: ")
if cont == "no" and "n":
continue
else:
input("Press any key to exit")
exit()
# ______________________________________End Loop



Comments