Reply
Thread Tools
iancumihai's Avatar
Posts: 274 | Thanked: 143 times | Joined on Jun 2007 @ Romania
#11
great ... let's see if this could be a productive weekend.
 
anidel's Avatar
Posts: 1,743 | Thanked: 1,231 times | Joined on Jul 2006 @ Twickenham, UK
#12
Here it is the code, remember it's just a hack to retrieve the URL and see if that can be played back, that is not meant to be production quality code

def get_rtsp():
youtubeclient = gdata.service.GDataService(server="gdata.youtube.c om")
results = youtubeclient.Get("http://gdata.youtube.com/feeds/api/videos?orderby=viewCount&max-results=1&format=1&vq=n810")
for video in results.entry:
mediaGroup = video.FindExtensions(tag='group')
print mediaGroup[0].FindChildren(tag='title')[0].text
for content in mediaGroup[0].FindChildren(tag='content'):
print content.attributes['url']
content = mediaGroup[0].FindChildren(tag='content')[1]
return content.attributes['url']
Sorry for the ", but looks like it's the only way to make indent here.
Anyway the trick is to get the GDataService first and then make the query by means of GET HTTP requests.
In those GET yuo can provide a bounch of parameters to refine the search.
The Youtube GDATA API documents all of them exaustively.

The answer is an XML message that need to be parsed (and here the power of python helps a lot).
There was a python library, but Google updated the youtube API to adapt them to the Google ones.

The URL we're looking for, looks like its[1] in the <media:group> block for that video entry. Specifically the <media:content ...> tag.
The 'url' attribute is the RTSP stream URI.
(Other attributes will be useful when displaying it to the user).

So that's the easy part actually

Once I've got the URL we need to play it.
I've tried to call the GStreamer player with:

player = gst.element_factory_make("playbin", "player")
....
player.set_property('uri', uri)
player.set_state(gst.STATE_PLAYING)
but with no luck so far.
Moreover, executing:

mplayer rtsp://....
gives an error :

unsupported RTSP server. Server type is 'Google RTSP 1.0'.
along with a

Connecting to server rtsp2.youtube.com[72.14.221.177]: 80...
connect error: Connection refused
References:

[1] http://code.google.com/apis/youtube/...earchingVideos

Last edited by anidel; 2008-02-21 at 16:30.
 
anidel's Avatar
Posts: 1,743 | Thanked: 1,231 times | Joined on Jul 2006 @ Twickenham, UK
#13
Wow.. the quote above makes the thread look very bad!
And the "edit" button is hidden to me!

UPDATE: Safari 3 renders the page correctly, while Firefox 2...12 does not. Great :/

Last edited by anidel; 2008-02-21 at 16:27.
 
iancumihai's Avatar
Posts: 274 | Thanked: 143 times | Joined on Jun 2007 @ Romania
#14
playing with python a little i got this

http://www.postimage.org/image.php?v=Pq1EKPM9

double clicking will start playing the video after a 5% buffering
using the great mplayer port.

the gui is usable only by me

improvments as soon as i get some time.

a mock up will be very useful

PS: how do i post a image in this thread?

Last edited by iancumihai; 2008-02-22 at 01:28.
 
Posts: 326 | Thanked: 39 times | Joined on Jul 2007
#15
Originally Posted by iancumihai View Post

PS: how do i post a image in this thread?
You have to use image tags ([IMG*]url[/IMG*])

*take out the asterisks in that.
 
Posts: 139 | Thanked: 24 times | Joined on Sep 2005
#16
Originally Posted by iancumihai View Post
i did not expected such an interest for a a youtube player.
let's see what i can do.
There is such a player in the works, quite far in development. I happened to be in #maemo when the developer asked for testers (maybe 1-2 weeks ago) and had a go with it: It looked quite promising, even though it had some bugs

I just checked IRC logs: his nick was tigrux.

Inz seems to have saved the testing packages he was hosting for tigrux: http://inz.fi/youtube-viewer-for-tablet/ . NOTE: These were testing packages, not meant for users. So don't blame me or the developer if something goes wrong...

Last edited by jussik; 2008-02-22 at 08:03.
 
iancumihai's Avatar
Posts: 274 | Thanked: 143 times | Joined on Jun 2007 @ Romania
#17
F@#@!#@k .... if only i would have known yesterday!

Now i'm too eager to continue what i've started, i'll do some more
coding until i run out of beers
 
anidel's Avatar
Posts: 1,743 | Thanked: 1,231 times | Joined on Jul 2006 @ Twickenham, UK
#18
We could join and help...
 
Posts: 28 | Thanked: 9 times | Joined on Dec 2007 @ A Corunha Ghalisia
#19
My idea:
Youtube generates a XML file for a search:
http://googlesystem.blogspot.com/200...ube-feeds.html

I know a command line app that can download any youtube video or can be connected through a pipe with a player/encoder, mplayer or ffmpeg or whatever

http://home.gna.org/clive/

I want to integrate that in a GUI to make a youtube player

But If you want you can use the idea because I don't know a lot of development stuff and it can take me ages to do that.
 
iancumihai's Avatar
Posts: 274 | Thanked: 143 times | Joined on Jun 2007 @ Romania
#20
that's what i have done in 3hours of coding last night.

i took a look at youtube-viewer_0.1-1_all.deb code.

it's pretty nicely written, it uses gstreamer and has a more complex approach, you can give it a try (check the link provided above by jussik)

i'm still stubborned enough to see i can i do with my app and i will still give it a try a few more days
 
Reply


 
Forum Jump


All times are GMT. The time now is 00:36.