conduit r1289 - in trunk: . conduit/modules/GoogleModule
- From: thomasvm svn gnome org
- To: svn-commits-list gnome org
- Subject: conduit r1289 - in trunk: . conduit/modules/GoogleModule
- Date: Fri, 8 Feb 2008 22:27:48 +0000 (GMT)
Author: thomasvm
Date: Fri Feb 8 22:27:48 2008
New Revision: 1289
URL: http://svn.gnome.org/viewvc/conduit?rev=1289&view=rev
Log:
2008-02-08 Thomas Van Machelen <thomas vanmachelen gmail com>:
* conduit/modules/GoogleModule/GoogleModule.py: Youtube changed
apparently changed for data format, use a new trick to get the flv
files. Fixes #514589.
Modified:
trunk/ChangeLog
trunk/conduit/modules/GoogleModule/GoogleModule.py
Modified: trunk/conduit/modules/GoogleModule/GoogleModule.py
==============================================================================
--- trunk/conduit/modules/GoogleModule/GoogleModule.py (original)
+++ trunk/conduit/modules/GoogleModule/GoogleModule.py Fri Feb 8 22:27:48 2008
@@ -18,8 +18,6 @@
from gettext import gettext as _
-import re
-
#Distributors, if you ship python gdata >= 1.0.10 then remove this line
#and the appropriate directories
Utils.dataprovider_add_dir_to_path(__file__)
@@ -684,7 +682,6 @@
USERS_FEED = "http://gdata.youtube.com/feeds/users"
STD_FEEDS = "http://gdata.youtube.com/feeds/standardfeeds"
- VIDEO_NAME_RE = re.compile(r', "t": "([^"]+)"')
def __init__(self, *args):
DataProvider.DataSource.__init__(self)
@@ -765,7 +762,7 @@
videos = self._favorite_videos (self.username)
for video in videos:
- self.entries[video.title.text] = self._get_flv_video_url (video.link[1].href)
+ self.entries[video.title.text] = self._get_flv_video_url (video.link[0].href)
except Exception, err:
log.debug("Error getting/parsing feed (%s)" % err)
raise Exceptions.RefreshError
@@ -830,22 +827,21 @@
# Generic extract step
def _get_flv_video_url (self, url):
- import urllib2
+ """
+ Previous code from here [1] was no longer working,
+ therefore we try the trick from here [2]
+ [1] http://svn.pythonfr.org/public/pythonfr/video/youtube_client.py
+ [2] http://www.abdulqabiz.com/blog/archives/general/update_getting_youtu.php
+ """
flv_url = ''
doc = urllib2.urlopen(url)
- data = doc.read()
- # extract video name
- match = YouTubeSource.VIDEO_NAME_RE.search(data)
- if match is not None:
- video_name = match.group(1)
-
- # extract video id
- url_splited = url.split("watch?v=")
- video_id = url_splited[1]
+ # extract video id
+ url_splited = url.split("watch?v=")
+ video_id = url_splited[1]
- flv_url = "http://www.youtube.com/get_video?video_id=%s&t=%s"
- flv_url = flv_url % (video_id, video_name)
+ flv_url = "http://cache.googlevideo.com/get_video?video_id=%s&origin=youtube"
+ flv_url = flv_url % video_id
return flv_url
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]