Merci aazerty pour le retour. Impossible d'ouvrir avec le bloc-note, mais pas de problème avec Notepad...nickel !!
Cependant, malgré de nombreux changement, aucun proxy ne fonctionne. Désolé.
Merci encore.
# -*- coding:utf-8 -*-
# TOU.TV version 0.6 par k3c
# passage de proxy en 2 ème parametre
import subprocess, optparse, re, sys, os, shlex
import socket, random
from urllib2 import ProxyHandler, Request, urlopen, URLError, HTTPError
import bs4 as BeautifulSoup
from lxml import objectify
from lxml import etree
import urllib2
timeout = 900
listeUserAgents = [ 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_5; fr-fr) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1',
'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.186 Safari/535.1',
'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13',
'Mozilla/5.0 (X11; U; Linux x86_64; en-us) AppleWebKit/528.5+ (KHTML, like Gecko, Safari/528.5+) midori',
'Mozilla/5.0 (Windows NT 6.0) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.107 Safari/535.1',
'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/312.1 (KHTML, like Gecko) Safari/312',
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.12 Safari/535.11',
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.8 (KHTML, like Gecko) Chrome/17.0.940.0 Safari/535.8' ]
def get_proxy():
opener = urllib2.build_opener()
opener.addheaders = [('User-agent', random.choice(listeUserAgents))]
data = opener.open('http://www.xroxy.com/proxy-country-CA.htm').read()
opener.close()
s = BeautifulSoup.BeautifulSoup(data)
hrefs = s.find_all(attrs={'href' : re.compile("host=\d")})
href = random.choice(hrefs)
mastr = href.attrs['href']
m = re.search('host=(([0-9\.])+)?.*port=(([0-9\.])+)?',str(mastr))
port = m.group(3)
host = m.group(1)
return host, port
def main():
# timeout en secondes
socket.setdefaulttimeout(timeout)
usage = "usage: python toutv [options] <url de l'emission>"
parser = optparse.OptionParser( usage = usage )
parser.add_option( "--nocolor", action = 'store_true', default = False, help = 'desactive la couleur dans le terminal' )
parser.add_option( "-v", "--verbose", action = "store_true", default = False, help = 'affiche les informations de debugage' )
( options, args ) = parser.parse_args()
if( len( args ) == 0 or args[ 0 ] == "" ):
parser.print_help()
parser.exit( 1 )
the_url = sys.argv[1]
html = urlopen(sys.argv[1]).read()
nom = sys.argv[1][18:].replace('/', '_')
soup = BeautifulSoup.BeautifulSoup(html)
elems = [elem for elem in soup.find('div',{'class':'emissionEpisode_containerPlayer'})]
mastr = elems[1].attrs['src']
m = re.search('"idMedia":"([A-Za-z0-9_]*)',mastr)
if m:
id = m.group(1)
head = random.choice( listeUserAgents )
platform = 'http://release.theplatform.com/content.select?pid='
response = urllib2.urlopen(urllib2.Request(platform+id))
newfile = response.read()
if len(sys.argv) > 2:
host, port = sys.argv[2].split(":")[0], sys.argv[2].split(":")[1]
else:
host, port = "69.46.99.186", "80"
if "You are not in a geographic region that has access to this content." in newfile:
while (True):
try:
print 'proxy utilisé %s:%s' % (host, port)
proxy_support = urllib2.ProxyHandler({'http': 'http://%s:%s/' % (host, port)})
opener = urllib2.build_opener(proxy_support)
urllib2.install_opener(opener)
response = urllib2.urlopen(urllib2.Request(platform+id))
newfile = response.read()
response.close()
break
except KeyboardInterrupt:
sys.exit()
except:
host, port = get_proxy()
root = objectify.fromstring(newfile)
rtmp = None
for x in root.findall('choice'):
if x.url.text.startswith('rtmp'):
rtmp = x.url.text
break
if rtmp is None:
print "aucun proxy valide"
sys.exit(1)
info_video = rtmp
host = info_video.split('rtmp://')[1].split('/')[0]
start = rtmp.index('ondemand')
end = rtmp.index('<break>')
app = rtmp[start:end]
st = rtmp.index('<break>')+len('<break>')
en = len(rtmp)
playpath = rtmp[st:en]
cmds = "rtmpdump"+" --host "+host+" --app \""+app+"\" --playpath \""+playpath+"\" -e -k 1 --flv "+str(nom)+".flv"
arguments = shlex.split( cmds )
process = subprocess.Popen( arguments, stdout = subprocess.PIPE).communicate()[0]
if __name__ == "__main__":
main()
coolboygf a écrit:J'ai tenté de désinstaller et de réinstaller, mais je n'ai jamais trouvé
comment le faire.
Je dois être trop nulle
Retourner vers Autres logiciels
Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 6 invités