Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #/home/clockworkpc/bin/gdata_youtube.py
- # Released under a GPLv3 Licence by Clockwork PC 2013
- # www.clockworkpc.com.au
- # You are entitled to the following four freedoms:
- # Freedom 0: To run this program for any purpose
- # Freedom 1: To study how this program works and change it to make it do what you wish
- # Freedom 2: To redistribute copies so you can help your neighbour
- # Freedom 3: To distribute copies of your modified version to others
- import os
- import re
- #Fetch video data from YouTube
- videoFolder = os.getenv("HOME") + "/Videos/tubemixing/"
- videoName = raw_input("What is the YouTube file name? ")
- os.system("cd ~/Videos/tubemixing/ && wget" + " " "http://gdata.youtube.com/feeds/api/videos/" + videoName + " " + "-O" + " " + videoName + ".txt")
- # Parse video data from YouTube
- videoFolder2 = os.getenv("HOME") + "/Videos/tubemixing/NamedVideos/"
- videoFileName = videoFolder + videoName + ".txt"
- f = open(videoFileName)
- for line in f:
- if "<title type='text'>" in line:
- x = line
- r = re.compile("<title type='text'>(.*?)</title><content")
- m = r.search(x)
- if m:
- titleInfo = m.group(1)
- # Copy renamed file into separate folder
- print titleInfo
- os.system("cp -v " + videoFolder + videoName + " " + videoFolder2 + "'" + titleInfo + "'")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement