29__author__=
"R.D. Vaughan"
39__usage_examples__ =
r'''
42Usage: ./youtube.py -hduvlST [parameters] <search text>
43Version: v0.2.0 Author: R.D.Vaughan
45For details on the MythTV Netvision plugin see the wiki page at:
46http://www.mythtv.org/wiki/MythNetvision
49 -h, --help show this help message and exit
50 -d, --debug Show debugging info (URLs, raw XML ... etc, info
52 -u, --usage Display examples
for executing the script
53 -v, --version Display grabber name
and supported options
54 -l LANGUAGE, --language=LANGUAGE
55 Select data that matches the specified language fall
56 back to English
if nothing found (e.g.
'es' EspaƱol,
57 'de' Deutsch ... etc). Not all sites
or grabbers
59 -p PAGE NUMBER, --pagenumber=PAGE NUMBER
60 Display specific page of the search results. Default
61 is page 1. Page number
is ignored
with the Tree View
63 -S, --search Search
for videos
64 -T, --treeview Display a Tree View of a sites videos
67(Search youtube
for videos matching search words)
68> ./youtube.py -S
"Buckethead" -p 2
69<?xml version=
"1.0" encoding=
"UTF-8"?>
71xmlns:itunes=
"http://www.itunes.com/dtds/podcast-1.0.dtd"
72xmlns:content=
"http://purl.org/rss/1.0/modules/content/"
73xmlns:cnettv=
"http://cnettv.com/mrss/"
74xmlns:creativeCommons=
"http://backend.userland.com/creativeCommonsRssModule"
75xmlns:media=
"http://search.yahoo.com/mrss/"
76xmlns:atom=
"http://www.w3.org/2005/Atom"
77xmlns:amp=
"http://www.adobe.com/amp/1.0"
78xmlns:dc=
"http://purl.org/dc/elements/1.1/">
80 <title>YouTube</title>
81 <link>http://www.youtube.com/</link>
82 <description>Share your videos
with friends, family,
and the world.</description>
83 <numresults>2092</numresults>
84 <returned>20</returned>
85 <startindex>40</startindex>
87 <title>Buckethead
and Brain Jam [original video]</title>
88 <author>bunghole30</author>
89 <pubDate>Sat, 20 Sep 2008 20:37:42 GMT</pubDate>
90 <description>Hey guy
's ;) \m/ Here, we have a video of Buckethead along with Brain, havin a jam session along with a few Buckethead binge buddy antics, please enjoy www.bucketheadland.com www.tdrsmusic.com -bunghole \m/</description>
91 <link>http://www.youtube.com/v/S7l3L6Ikb9M?f=videos&app=youtube_gdata&autoplay=1</link>
93 <media:thumbnail url='http://i.ytimg.com/vi/S7l3L6Ikb9M/0.jpg'/>
94 <media:content url=
'http://www.youtube.com/v/S7l3L6Ikb9M?f=videos&app=youtube_gdata&autoplay=1' duration=
'399' width=
'' height=
'' lang=
''/>
96 <rating>4.941772</rating>
100 <title>Slap That Bass, Buckethead</title>
101 <author>R41N570RM</author>
102 <pubDate>Fri, 29 Jun 2007 01:25:40 GMT</pubDate>
103 <description>Buckethead on Bass Slappin
' and Maximum Bob with Willie T. From Secret Recipe</description>
104 <link>http://www.youtube.com/v/0QA-1EeVLvg?f=videos&app=youtube_gdata&autoplay=1</link>
106 <media:thumbnail url='http://i.ytimg.com/vi/0QA-1EeVLvg/0.jpg'/>
107 <media:content url=
'http://www.youtube.com/v/0QA-1EeVLvg?f=videos&app=youtube_gdata&autoplay=1' duration=
'111' width=
'' height=
'' lang=
''/>
109 <rating>4.890556</rating>
115(Retrieve a Tree View of the YouTube Video Categories)
117<?xml version=
"1.0" encoding=
"UTF-8"?>
119xmlns:itunes=
"http://www.itunes.com/dtds/podcast-1.0.dtd"
120xmlns:content=
"http://purl.org/rss/1.0/modules/content/"
121xmlns:cnettv=
"http://cnettv.com/mrss/"
122xmlns:creativeCommons=
"http://backend.userland.com/creativeCommonsRssModule"
123xmlns:media=
"http://search.yahoo.com/mrss/"
124xmlns:atom=
"http://www.w3.org/2005/Atom"
125xmlns:amp=
"http://www.adobe.com/amp/1.0"
126xmlns:dc=
"http://purl.org/dc/elements/1.1/">
128 <title>YouTube</title>
129 <link>http://www.youtube.com/</link>
130 <description>Share your videos
with friends, family,
and the world.</description>
131 <numresults>13239230</numresults>
132 <returned>20</returned>
133 <startindex>20</startindex>
134 <directory name=
"Feeds" thumbnail=
"/usr/local/share/mythtv/mythnetvision/icons/youtube.png">
135 <directory name=
"Highest Rated" thumbnail=
"/usr/local/share/mythtv/mythnetvision/icons/directories/topics/rated.png">
137 <title>Project
for Awesome - My Public Access Channel!</title>
138 <author>peron75</author>
139 <pubDate>Thu, 17 Dec 2009 13:51:34 GMT</pubDate>
140 <description>Please support all the Project
for Awesome videos today
with ratings/comments! Thank you! Thank you to Hank
and John Green, Dan Brown
and everyone involved!!! I chose the public access station where I began What the Buck! They are fundraising to help
with their new building project. You can help buy simply signing up
for this site
and then when you shop, they get donations
from that! Yay! Thanks
if you can sign up! (its Free!) LOL xoxo Michael Please sign up: http://igive.com/wpaa</description>
141 <link>http://www.youtube.com/v/tdBHzkoXB_8?f=standard&app=youtube_gdata&autoplay=1</link>
143 <media:thumbnail url=
'http://i.ytimg.com/vi/tdBHzkoXB_8/hqdefault.jpg'/>
144 <media:content url=
'http://www.youtube.com/v/tdBHzkoXB_8?f=standard&app=youtube_gdata&autoplay=1' duration=
'259' width=
'' height=
'' lang=
''/>
146 <rating>4.972514</rating>
150 <title>Harry Chapin--Taxi</title>
151 <author>Lewismadmax</author>
152 <pubDate>Fri, 04 May 2007 21:10:00 GMT</pubDate>
153 <description>
"Baby's so high that shes skying, yeah she's flying afraid to fall, I'll tell you why Baby's crying, cuz' she's dying arent we all". The greatest person to fight world hunger died
in 1982 God bless Harry Chapin.</description>
154 <link>http://www.youtube.com/v/c5dwksSbD34?f=videos&app=youtube_gdata&autoplay=1</link>
156 <media:thumbnail url=
'http://i.ytimg.com/vi/c5dwksSbD34/hqdefault.jpg'/>
157 <media:content url=
'http://www.youtube.com/v/c5dwksSbD34?f=videos&app=youtube_gdata&autoplay=1' duration=
'401' width=
'' height=
'' lang=
''/>
159 <rating>4.9039855</rating>
166__search_max_page_items__ = 10
167__tree_max_page_items__ = 20
172#import nv_python_libs.youtube.youtube_api as target
174# Verify that the tmdb_api modules are installed and accessible
177except Exception
as e:
179The subdirectory "nv_python_libs/youtube" containing the modules youtube_api.py (v0.2.0 or greater),
180They should have been included with the distribution of youtube.py.
185if target.__version__ <
'0.2.0':
186 sys.stderr.write(
"\n! Error: Your current installed youtube_api.py version is (%s)\nYou must at least have version (0.2.0) or higher.\n" % target.__version__)
193except Exception
as e:
195The python script "nv_python_libs/mainProcess.py" must be present.
200if process.__version__ <
'0.2.0':
201 sys.stderr.write(
"\n! Error: Your current installed mainProcess.py version is (%s)\nYou must at least have version (0.2.0) or higher.\n" % process.__version__)
204if __name__ ==
'__main__':
207 target.baseProcessingDir = os.path.dirname( os.path.realpath(__file__))
208 main = process.mainProcess(target, apikey, )
209 main.grabberInfo = {}
210 main.grabberInfo[
'enabled'] =
True
211 main.grabberInfo[
'title'] = __title__
212 main.grabberInfo[
'command'] =
'youtube.py'
213 main.grabberInfo[
'author'] = __author__
214 main.grabberInfo[
'thumbnail'] =
'youtube.png'
215 main.grabberInfo[
'type'] = [
'video']
216 main.grabberInfo[
'desc'] =
"Share your videos with friends, family, and the world."
217 main.grabberInfo[
'version'] = __version__
218 main.grabberInfo[
'search'] =
True
219 main.grabberInfo[
'tree'] =
True
220 main.grabberInfo[
'html'] =
False
221 main.grabberInfo[
'usage'] = __usage_examples__
222 main.grabberInfo[
'SmaxPage'] = __search_max_page_items__
223 main.grabberInfo[
'TmaxPage'] = __tree_max_page_items__