from urllib2 import Request, URLError, HTTPError, urlopen as urlopen2
from socket import gaierror,error
import re, os, sys, socket
-import urllib
-from urllib import FancyURLopener, quote
+#import urllib
+from urllib import quote, unquote_plus, unquote #FancyURLopener,
import cookielib
from httplib import HTTPConnection,CannotSendRequest,BadStatusLine,HTTPException
HTTPConnection.debuglevel = 1
#config.plugins.mytube.general.useHTTPProxy = ConfigYesNo(default = False)
#config.plugins.mytube.general.ProxyIP = ConfigIP(default=[0,0,0,0])
#config.plugins.mytube.general.ProxyPort = ConfigNumber(default=8080)
-
-class MyOpener(FancyURLopener):
- version = 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.12) Gecko/20070731 Ubuntu/dapper-security Firefox/1.5.0.12'
+#class MyOpener(FancyURLopener):
+# version = 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.12) Gecko/20070731 Ubuntu/dapper-security Firefox/1.5.0.12'
class GoogleSuggestions():
self.entry = entry
self.favoritesFeed = favoritesFeed
self.thumbnail = {}
- self.myopener = MyOpener()
+ """self.myopener = MyOpener()
urllib.urlopen = MyOpener().open
- """if config.plugins.mytube.general.useHTTPProxy.value is True:
+ if config.plugins.mytube.general.useHTTPProxy.value is True:
proxy = {'http': 'http://'+str(config.plugins.mytube.general.ProxyIP.getText())+':'+str(config.plugins.mytube.general.ProxyPort.value)}
self.myopener = MyOpener(proxies=proxy)
urllib.urlopen = MyOpener(proxies=proxy).open
if mobj is None:
print 'ERROR: unable to extract "t" parameter for unknown reason'
else:
- reason = urllib.unquote_plus(mobj.group(1))
+ reason = unquote_plus(mobj.group(1))
print 'ERROR: YouTube said: %s' % reason.decode('utf-8')
return mrl
- token = urllib.unquote(mobj.group(1))
+ token = unquote(mobj.group(1))
myurl = 'http://www.youtube.com/get_video?video_id=%s&t=%s&eurl=&el=detailpage&ps=default&gl=US&hl=en' % (video_id, token)
if isHDAvailable is True:
mrl = '%s&fmt=%s' % (myurl, '22')