本文整理汇总了Python中urlparse.parse_qs函数的典型用法代码示例。如果您正苦于以下问题:Python parse_qs函数的具体用法?Python parse_qs怎么用?Python parse_qs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_qs函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_url_sort_options
def test_url_sort_options(self):
feed = 'http://www.my.jobs/jobs/feed/rss?date_sort=False'
# Test to make sure sort by "Relevance" has '&date_sort=False' added
# a single time
feed_url = url_sort_options(feed, "Relevance")
parsed = urlparse(feed_url)
query = parse_qs(parsed.query)
self.assertEquals(parsed.path, "/jobs/feed/rss")
self.assertEquals(query['date_sort'], [u'False'])
# If a frequency isn't specified, days_ago should be missing from
# the url.
self.assertNotIn('days_ago', query)
# Test to make sure sort by "Date" doesn't have anything added
feed_url = url_sort_options(feed, "Date")
self.assertEquals(feed_url, "http://www.my.jobs/jobs/feed/rss")
# Test to make sure that passing in a frequency does in fact
# add the frequency to the feed url.
feed_url = url_sort_options(feed, "Relevance", frequency='D')
query = parse_qs(urlparse(feed_url).query)
self.assertEquals(query['days_ago'][0], '1')
feed_url = url_sort_options(feed, "Relevance", frequency='W')
query = parse_qs(urlparse(feed_url).query)
self.assertEquals(query['days_ago'][0], '7')
feed_url = url_sort_options(feed, "Relevance", frequency='M')
query = parse_qs(urlparse(feed_url).query)
self.assertEqual(query['days_ago'][0], '30')
开发者ID:kepinq,项目名称:MyJobs,代码行数:29,代码来源:test_helpers.py
示例2: send_head
def send_head(self):
"""Common code for GET and HEAD commands.
Here be dragons
"""
# src http://stackoverflow.com/a/5075477
url = self.path
parsed = urlparse.urlparse(url)
query = parsed.query
if query:
# remove last character '/' in query
if query[-1] == "/":
query = query[:-1]
try:
data = "".join(urlparse.parse_qs(query)["data"])
secret_try = "".join(urlparse.parse_qs(query)["secret"])
except:
self.send_error(400, "Bad Request")
return None
if secret_try != secret:
self.send_error(401, "Unauthorized")
return None
# src http://stackoverflow.com/questions/13745648/running-bash-script-from-within-python
subprocess.call(script_name + " " + data, shell=True)
self.send_response(200)
开发者ID:pedro-nonfree,项目名称:guifi-tools-and-scripts,代码行数:30,代码来源:MikrotikHTTPHandler_alert_xat_guifi.py
示例3: setup_oauth
def setup_oauth(self):
# Request token
oauth = OAuth1(CONSUMER_KEY, client_secret=CONSUMER_SECRET)
r = requests.post(url=REQUEST_TOKEN_URL, auth=oauth)
credentials = parse_qs(r.content)
resource_owner_key = credentials.get('oauth_token')[0]
resource_owner_secret = credentials.get('oauth_token_secret')[0]
# Authorize
authorize_url = AUTHORIZE_URL + resource_owner_key
print 'Please go here and authorize: ' + authorize_url
verifier = raw_input('Please input the verifier: ')
oauth = OAuth1(CONSUMER_KEY,
client_secret=CONSUMER_SECRET,
resource_owner_key=resource_owner_key,
resource_owner_secret=resource_owner_secret,
verifier=verifier)
# Finally, Obtain the Access Token
r = requests.post(url=ACCESS_TOKEN_URL, auth=oauth)
credentials = parse_qs(r.content)
token = credentials.get('oauth_token')[0]
secret = credentials.get('oauth_token_secret')[0]
return token, secret
开发者ID:dscamp,项目名称:pytooter,代码行数:27,代码来源:pytoot.py
示例4: movie
def movie(self, imdb, title, year):
try:
query = self.search_link % urllib.quote_plus(title)
query = urlparse.urljoin(self.base_link, query)
result = self.request(query, 'movie_table')
result = client.parseDOM(result, 'div', attrs = {'class': 'movie_table'})
title = cleantitle.get(title)
years = ['(%s)' % str(year), '(%s)' % str(int(year)+1), '(%s)' % str(int(year)-1)]
result = [(client.parseDOM(i, 'a', ret='href'), client.parseDOM(i, 'img', ret='alt')) for i in result]
result = [(i[0][0], i[1][0]) for i in result if len(i[0]) > 0 and len(i[1]) > 0]
result = [i for i in result if any(x in i[1] for x in years)]
result = [i[0] for i in result if title == cleantitle.get(i[1])][0]
url = client.replaceHTMLCodes(result)
try: url = urlparse.parse_qs(urlparse.urlparse(url).query)['q'][0]
except: pass
try: url = urlparse.parse_qs(urlparse.urlparse(url).query)['u'][0]
except: pass
url = urlparse.urlparse(url).path
url = client.replaceHTMLCodes(url)
url = url.encode('utf-8')
return url
except:
return
开发者ID:AMOboxTV,项目名称:AMOBox.LegoBuild,代码行数:27,代码来源:movie25_mv.py
示例5: resolve
def resolve(url):
try:
id = urlparse.parse_qs(urlparse.urlparse(url).query)['c'][0]
try:
referer = urlparse.parse_qs(urlparse.urlparse(url).query)['referer'][0]
except:
referer= url
url = 'http://castamp.com/embed.php?c=%s&vwidth=640&vheight=380'%id
pageUrl=url
result = client.request(url, referer=referer,headers = {'Host':'www.castamp.com'})
result = urllib.unquote(result).replace('unescape(','').replace("'+'",'')
rplcs = re.findall('=(.+?).replace\([\"\'](.+?)[\"\']\s*,\s*[\"\']([^\"\']*)[\"\']',result)
result = re.sub('\/\*[^*]+\*\/','',result)
var = re.compile('var\s(.+?)\s*=\s*[\'\"](.+?)[\'\"]').findall(result)
var_dict = dict(var)
file = re.compile('\'file\'\s*:\s*(.+?),').findall(result)[-1]
file = var_dict[file]
rtmp = re.compile('(rtmp://[^\"\']+)').findall(result)[0]
for r in rplcs:
file = file.replace(r[1],r[2])
url = rtmp + ' playpath=' + file + ' swfUrl=http://p.castamp.com/cplayer.swf' + ' flashver=' + constants.flash_ver() + ' live=true timeout=15 swfVfy=1 pageUrl=' + pageUrl
return url
except:
return
开发者ID:msousinha,项目名称:myhome-repository,代码行数:28,代码来源:castamp.py
示例6: resolve
def resolve(url):
try:
try:
cid = urlparse.parse_qs(urlparse.urlparse(url).query)['cid'][0]
except:
cid = re.compile('channel/(.+?)(?:/|$)').findall(url)[0]
try:
referer = urlparse.parse_qs(urlparse.urlparse(url).query)['referer'][0]
except:
referer='http://castalba.tv'
url = 'http://castalba.tv/embed.php?cid=%s&wh=600&ht=380&r=%s'%(cid,urlparse.urlparse(referer).netloc)
pageUrl=url
result = client.request(url, referer=referer,mobile=True)
result = decryptionUtils.doDemystify(result)
result=urllib.unquote(result)
var = re.compile('var\s(.+?)\s*=\s*[\'\"](.+?)[\'\"]').findall(result)
var_dict = dict(var)
if 'm3u8' in result:
url = re.compile('(?:var\s*)?file.+?\s*=\s*(?:unescape\()[\'\"](.+?)[\'\"]').findall(result)[-1]
url = 'http://' + url + '.m3u8'
url += '|%s' % urllib.urlencode({'User-Agent': client.agent(), 'Referer': url,'X-Requested-With':constants.get_shockwave()})
log("Castalba: Found m3u8 url: " + url)
else:
try:
filePath = re.compile("'file'\s*:\s*(?:unescape\()?'(.+?)'").findall(result)[0]
except:
file = re.findall('(?:var\s*)?file\s*=\s*(?:unescape\()?(?:\'|\")(.+?)(?:\'|\")',result)[-1]
try:
file2 = re.findall("'file':\s*unescape\(file\)\s*\+\s*unescape\('(.+?)'\)",result)[0]
filePath = file+file2
except:
filePath = file
swf = re.compile("'flashplayer'\s*:\s*\"(.+?)\"").findall(result)[0]
sm = re.findall("'streamer':(.+?),",result)[0]
strm_funcs = re.findall('function\s*(.+?)\s*\{([^\}]+)',result,flags=re.DOTALL)
for f in strm_funcs:
if f[0] in ['(p,a,c,k,e,r)','()']:
continue
if '%s'%f[0] in sm:
strm_func = f[1]
break
strm_func = re.sub('\s//[^;]+','',strm_func)
streamer = 'rtmp://' + re.findall('.*["\'/](\d{1,3}\.\d{1,3}\.\d{1,3}\.[^"\'/]+)["\'/]',strm_func)[0] + '/live'
streamer = streamer.replace('///','//')
url = streamer + ' playpath=' + filePath +' swfUrl=' + swf + ' flashver=' + constants.flash_ver() +' live=true timeout=15 swfVfy=true pageUrl=' + pageUrl
log("Castalba: Found rtmp link: " + url)
return url
except:
log("Castalba: Resolver failed. Returning...")
return
开发者ID:stick141,项目名称:modules4all,代码行数:60,代码来源:castalba.py
示例7: test_expired_creating_keystone_token
def test_expired_creating_keystone_token(self):
CONF.oauth1.access_token_duration = -1
consumer = self._create_single_consumer()
consumer_id = consumer.get('id')
consumer_secret = consumer.get('secret')
self.consumer = oauth1.Consumer(consumer_id, consumer_secret)
self.assertIsNotNone(self.consumer.key)
url, headers = self._create_request_token(self.consumer,
self.project_id)
content = self.post(url, headers=headers)
credentials = urlparse.parse_qs(content.result)
request_key = credentials.get('oauth_token')[0]
request_secret = credentials.get('oauth_token_secret')[0]
self.request_token = oauth1.Token(request_key, request_secret)
self.assertIsNotNone(self.request_token.key)
url = self._authorize_request_token(request_key)
body = {'roles': [{'id': self.role_id}]}
resp = self.put(url, body=body, expected_status=200)
self.verifier = resp.result['token']['oauth_verifier']
self.request_token.set_verifier(self.verifier)
url, headers = self._create_access_token(self.consumer,
self.request_token)
content = self.post(url, headers=headers)
credentials = urlparse.parse_qs(content.result)
access_key = credentials.get('oauth_token')[0]
access_secret = credentials.get('oauth_token_secret')[0]
self.access_token = oauth1.Token(access_key, access_secret)
self.assertIsNotNone(self.access_token.key)
url, headers, body = self._get_oauth_token(self.consumer,
self.access_token)
self.post(url, headers=headers, body=body, expected_status=401)
开发者ID:littlebean,项目名称:keystone,代码行数:35,代码来源:test_v3_oauth1.py
示例8: get_msg
def get_msg(hinfo, binding, response=False):
if binding == BINDING_SOAP:
msg = hinfo["data"]
elif binding == BINDING_HTTP_POST:
_inp = hinfo["data"][3]
i = _inp.find(TAG1)
i += len(TAG1) + 1
j = _inp.find('"', i)
msg = _inp[i:j]
elif binding == BINDING_HTTP_ARTIFACT:
# either by POST or by redirect
if hinfo["data"]:
_inp = hinfo["data"][3]
i = _inp.find(TAG1)
i += len(TAG1) + 1
j = _inp.find('"', i)
msg = _inp[i:j]
else:
parts = urlparse(hinfo["url"])
msg = parse_qs(parts.query)["SAMLart"][0]
else: # BINDING_HTTP_REDIRECT
parts = urlparse(hinfo["headers"][0][1])
msg = parse_qs(parts.query)["SAMLRequest"][0]
return msg
开发者ID:Itxaka,项目名称:pysaml2,代码行数:25,代码来源:test_64_artifact.py
示例9: get_episode
def get_episode(self, url, imdb, tvdb, title, date, season, episode):
try:
if url == None: return
season = '%01d' % int(season)
episode = '%01d' % int(episode)
query = '%s "Season %s" "Episode %s"' % (url, season, episode)
query = urlparse.urljoin(self.base_link, self.tvsearch_link + urllib.quote_plus(query))
result = cloudflare.source(query)
if result == None: result = client.source(self.__proxy() + urllib.quote_plus(query))
r = client.parseDOM(result, 'li', attrs = {'class': 'first element.+?'})
r += client.parseDOM(result, 'li', attrs = {'class': 'element.+?'})
r += client.parseDOM(result, 'header', attrs = {'class': 'entry-header'})
tvshowtitle = cleantitle.tv(url)
result = [(client.parseDOM(i, 'a', ret='href'), re.compile('(.+?): Season (\d*).+?Episode (\d*)').findall(i)) for i in r]
result = [(i[0][0], i[1][-1]) for i in result if len(i[0]) > 0 and len(i[1]) > 0]
result = [(i[0], i[1][0].split('>')[-1], i[1][1], i[1][2]) for i in result]
result = [i for i in result if season == '%01d' % int(i[2]) and episode == '%01d' % int(i[3])]
result = [i[0] for i in result if tvshowtitle == cleantitle.tv(i[1])][0]
url = client.replaceHTMLCodes(result)
try: url = urlparse.parse_qs(urlparse.urlparse(url).query)['u'][0]
except: pass
try: url = urlparse.parse_qs(urlparse.urlparse(url).query)['q'][0]
except: pass
url = urlparse.urlparse(url).path
url = url.encode('utf-8')
return url
except:
return
开发者ID:gsolanoalvarez,项目名称:hdfulltv,代码行数:35,代码来源:yifystream_mv_tv.py
示例10: resolve
def resolve(url):
try:
referer = urlparse.parse_qs(urlparse.urlparse(url).query)['referer'][0]
page = urlparse.parse_qs(urlparse.urlparse(url).query)['id'][0]
page = 'http://p2pcast.tv/stream.php?id=%s&live=0&p2p=0&stretching=uniform' % page
result = client.request(page, referer=referer)
try:
swf = re.compile('src\s*=[\'|\"](.+?player.+?\.js)[\'|\"]').findall(result)[0]
swf = client.request(swf)
swf = re.compile('flashplayer\s*:\s*[\'|\"](.+?)[\'|\"]').findall(swf)[0]
except:
swf = 'http://cdn.p2pcast.tv/jwplayer.flash.swf'
url = re.compile('url\s*=\s*[\'|\"](.+?)[\'|\"]').findall(result)[0]
url = base64.b64decode(url)
url = '%s|User-Agent=%s&Referer=%s' % (url, urllib.quote_plus(client.agent()), urllib.quote_plus(swf))
return url
except:
return
开发者ID:AMObox,项目名称:teammaniac,代码行数:25,代码来源:p2pcast.py
示例11: do_facebook
def do_facebook(url, environ, headers, options, cache):
log('fb stuff')
query = urlparse.urlparse(url).query
if 'code' in query:
# get real token from code
code = urlparse.parse_qs(query)['code'][0]
eurl = "https://graph.facebook.com/oauth/access_token?client_id={app_id}&redirect_uri={redirect_uri}&client_secret={app_secret}&code={code_parameter}".format(
app_id=FBAPPID, app_secret=FBSECRET, code_parameter=code, redirect_uri="http://morss.it/:facebook/")
token = urlparse.parse_qs(urllib2.urlopen(eurl).read().strip())['access_token'][0]
# get long-lived access token
eurl = "https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id={app_id}&client_secret={app_secret}&fb_exchange_token={short_lived_token}".format(
app_id=FBAPPID, app_secret=FBSECRET, short_lived_token=token)
values = urlparse.parse_qs(urllib2.urlopen(eurl).read().strip())
ltoken = values['access_token'][0]
expires = int(time.time() + int(values['expires'][0]))
headers['set-cookie'] = 'token={token}; Path=/'.format(token=ltoken)
# headers
headers['status'] = '303 See Other'
headers['location'] = 'http://{domain}/'.format(domain=environ['SERVER_NAME'])
log('fb done')
return
开发者ID:SamuelMarks,项目名称:morss,代码行数:28,代码来源:morss.py
示例12: HandleSetInducedError
def HandleSetInducedError(self, path):
query = urlparse.urlparse(path)[4]
self.account_lock.acquire()
code = 200;
response = 'Success'
error = sync_pb2.ClientToServerResponse.Error()
try:
error_type = urlparse.parse_qs(query)['error']
action = urlparse.parse_qs(query)['action']
error.error_type = int(error_type[0])
error.action = int(action[0])
try:
error.url = (urlparse.parse_qs(query)['url'])[0]
except KeyError:
error.url = ''
try:
error.error_description =(
(urlparse.parse_qs(query)['error_description'])[0])
except KeyError:
error.error_description = ''
self.account.SetInducedError(error)
response = ('Error = %d, action = %d, url = %s, description = %s' %
(error.error_type, error.action,
error.url,
error.error_description))
except error:
response = 'Could not parse url'
code = 400
finally:
self.account_lock.release()
return (code, '<html><title>SetError: %d</title><H1>%d %s</H1></html>' %
(code, code, response))
开发者ID:chromium-googlesource-mirror,项目名称:chromium_989,代码行数:32,代码来源:chromiumsync.py
示例13: setup_oauth
def setup_oauth():
"""Authorize your app via identifier."""
# Request token
oauth = OAuth1(APP_KEY, client_secret=APP_SECRET)
r = requests.post(url=REQUEST_TOKEN_URL, auth=oauth)
credentials = parse_qs(r.content)
resource_owner_key = credentials.get("oauth_token")[0]
resource_owner_secret = credentials.get("oauth_token_secret")[0]
# Authorize
authorize_url = AUTHORIZE_URL + resource_owner_key
print "Please go here and authorize: " + authorize_url
verifier = raw_input("Please input the verifier: ")
oauth = OAuth1(
APP_KEY,
client_secret=APP_SECRET,
resource_owner_key=resource_owner_key,
resource_owner_secret=resource_owner_secret,
verifier=verifier,
)
# Finally, Obtain the Access Token
r = requests.post(url=ACCESS_TOKEN_URL, auth=oauth)
credentials = parse_qs(r.content)
token = credentials.get("oauth_token")[0]
secret = credentials.get("oauth_token_secret")[0]
return token, secret
开发者ID:jvaleo,项目名称:pi_camera,代码行数:30,代码来源:oauth_setup_initial.py
示例14: _get_unit_lesson_from
def _get_unit_lesson_from(self, data):
"""Extract unit and lesson id from exercise data submission."""
# we need to figure out unit and lesson id for the exercise;
# we currently have no direct way of doing it, so we have to do it
# indirectly == ugly...; an exercise captures a page URL where it was
# embedded; we can parse that URL out and find all the interesting
# parts from the query string
unit_id = 0
lesson_id = 0
json = transforms.loads(data)
if json:
location = json.get('location')
if location:
location = urllib2.unquote(location)
params_map = urlparse.parse_qs(location)
ity_ef_origin = params_map.get('ity_ef_origin')
if ity_ef_origin:
ity_ef_origin = ity_ef_origin[0]
origin_path = urlparse.urlparse(ity_ef_origin)
if origin_path.query:
query = urlparse.parse_qs(origin_path.query)
unit_id = self._int_list_to_int(query.get('unit'))
lesson_id = self._int_list_to_int(query.get('lesson'))
# when we are on the first lesson of a unit, leson_id is
# not present :(; look it up
if not lesson_id:
lessons = self.get_course().get_lessons(unit_id)
if lessons:
lesson_id = lessons[0].lesson_id
return unit_id, lesson_id
开发者ID:tahmidrafi,项目名称:khan-exercises-coursebuilder,代码行数:34,代码来源:khanex.py
示例15: do_GET
def do_GET(self):
self.send_response(200)
self.send_header("Content-type", 'text/plain')
self.end_headers()
parsed_path = urlparse.urlparse(self.path)
print self.path
if '/requestAds.html' in parsed_path.path:
res = urlparse.parse_qs(parsed_path.query)
self.deal_req_ads(base64.decodestring(unquote(res['req'][0])))
elif '/winnoticeAds.html' in parsed_path.path:
res = urlparse.parse_qs(parsed_path.query)
self.deal_win_notice(res)
elif '/showmonUrl.html' in parsed_path.path:
res = urlparse.parse_qs(parsed_path.query)
self.deal_showmon_url(res)
elif '/click_url' in parsed_path.path:
res = urlparse.parse_qs(parsed_path.query)
self.deal_click_url(res)
elif '/requestAdViewAds.html' in parsed_path.path:
res = urlparse.parse_qs(parsed_path.query)
self.deal_req_adview(res)
elif '/adview_ec.jsp' in parsed_path.path or '/adview_es.jsp' in parsed_path.path:
self.wfile.write(self.path)
logger.info('adview %s', self.path)
开发者ID:rongc5,项目名称:test,代码行数:27,代码来源:__main__.py
示例16: get_movie
def get_movie(self, imdb, title, year):
try:
query = urlparse.urljoin(self.base_link, self.moviesearch_link + urllib.quote_plus(title))
result = cloudflare.source(query)
if result == None: result = client.source(self.__proxy() + urllib.quote_plus(query))
r = client.parseDOM(result, 'li', attrs = {'class': 'first element.+?'})
r += client.parseDOM(result, 'li', attrs = {'class': 'element.+?'})
r += client.parseDOM(result, 'header', attrs = {'class': 'entry-header'})
title = cleantitle.movie(title)
years = ['(%s)' % str(year), '(%s)' % str(int(year)+1), '(%s)' % str(int(year)-1)]
result = [(client.parseDOM(i, 'a', ret='href'), client.parseDOM(i, 'a')) for i in r]
result = [(i[0][0], i[1][0]) for i in result if len(i[0]) > 0 and len(i[1]) > 0]
result = [(i[0], re.compile('(.+? [(]\d{4}[)])').findall(i[1])) for i in result]
result = [(i[0], i[1][0]) for i in result if len(i[1]) > 0]
result = [i for i in result if title == cleantitle.movie(i[1])]
result = [i[0] for i in result if any(x in i[1] for x in years)][0]
url = client.replaceHTMLCodes(result)
try: url = urlparse.parse_qs(urlparse.urlparse(url).query)['u'][0]
except: pass
try: url = urlparse.parse_qs(urlparse.urlparse(url).query)['q'][0]
except: pass
url = urlparse.urlparse(url).path
url = url.encode('utf-8')
return url
except:
return
开发者ID:gsolanoalvarez,项目名称:hdfulltv,代码行数:31,代码来源:yifystream_mv_tv.py
示例17: connect
def connect(self, mongo_uri):
db_name, options = None, {}
u = urlparse.urlparse(mongo_uri)
if u.scheme == "file":
path = u.path
if "?" in u.path:
path, self._options = u.path.split("?", 1)
self._options = urlparse.parse_qs(self._options) if self._options else {}
path = u.netloc + path
self.db = _MongoImportFileSet(path)
if "uniq" in self._options and "md5" in self._options["uniq"]:
self._quick_uniq = _IdHashPairs(path)
elif u.scheme == "mongodb":
if "?" in u.path and u.query == "":
# url didn't parse it properly u.path is '/dbname?options
db_name, self._options = u.path.split("?", 1)
self._options = urlparse.parse_qs(self._options) if self._options else {}
else:
db_name = u.path
if db_name.startswith("/"):
db_name = db_name[1:]
# print 'Connecting to db %s on %s with options.' % (db_name, mongo_uri, options)
mongo = pymongo.Connection(mongo_uri)
self.db = mongo[db_name]
if "uniq" in self._options and "md5" in self._options["uniq"]:
self._quick_uniq = False
else:
raise ValueError("Invalid URI scheme: '%s'. Can only accept 'file' or 'mongodb'" % u.scheme)
开发者ID:buremba,项目名称:discogs-xml2db,代码行数:28,代码来源:mongodbexporter.py
示例18: resolve
def resolve(url):
try:
try:
referer = urlparse.parse_qs(urlparse.urlparse(url).query)['referer'][0]
except:
referer=url
id = urlparse.parse_qs(urlparse.urlparse(url).query)['u'][0]
url = 'http://www.finecast.tv/embed4.php?u=%s&vw=640&vh=450'%id
headers=[("User-Agent", client.agent()), ("Referer", referer)]
cj = get_cj()
result = unCaptcha.performCaptcha(url, cj, headers = headers)
result = decryptionUtils.doDemystify(result)
cj.save (cookieFile,ignore_discard=True)
file = re.findall('[\'\"](.+?.stream)[\'\"]',result)[0]
auth = re.findall('[\'\"](\?wmsAuthSign.+?)[\'\"]',result)[0]
rtmp = 'http://play.finecast.tv:1935/live/%s/playlist.m3u8%s'%(file,auth)
#url = rtmp + ' playpath=' + file + ' swfUrl=http://www.finecast.tv/player6/jwplayer.flash.swf flashver=' + constants.flash_ver() + ' live=1 timeout=14 pageUrl=' + url
return rtmp
except:
return
开发者ID:Mikel7220,项目名称:AwesomeStreams,代码行数:30,代码来源:finecast.py
示例19: resolve
def resolve(url):
try:
addonid = 'script.module.liveresolver'
user, password = control.setting('ustvnow_email'), control.setting('ustvnow_pass')
if (user == '' or password == ''):
user, password = control.addon(addonid).getSetting('ustvnow_email'), control.addon(addonid).getSetting('ustvnow_pass')
if (user == '' or password == ''): return ''
token = urllib.urlencode({'username': user, 'password': password})
token = 'http://m-api.ustvnow.com/gtv/1/live/login?%s&device=gtv&redir=0' % token
token = json.loads(client.request(token))['token']
result = 'http://m-api.ustvnow.com/gtv/1/live/playingnow?token=%s' % token
result = json.loads(client.request(result))
try:
scode = urlparse.parse_qs(urlparse.urlparse(url).query)['scode'][0]
except:
stream_code = urlparse.parse_qs(urlparse.urlparse(url).query)['stream_code'][0]
scode = [i['scode'] for i in result['results'] if i['stream_code'] == stream_code][0]
key = (result['globalparams']['passkey']).replace('key=', '')
url = 'http://m-api.ustvnow.com/stream/1/live/view?token=%s&key=%s&scode=%s' % (token, key, scode)
url = json.loads(client.request(url))['stream']
return url
except:
return ''
开发者ID:AMOboxTV,项目名称:AMOBox.LegoBuild,代码行数:30,代码来源:ustvnow.py
示例20: resolve
def resolve(url):
#try:
referer = urlparse.parse_qs(urlparse.urlparse(url).query)['referer'][0]
headers = { 'Referer': referer,
'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Content-Type' :'application/x-www-form-urlencoded',
'Connection' : 'keep-alive',
'Host' : 'www.zoomtv.me',
'Origin' : urlparse.urlparse(referer).netloc,
'User-Agent' : client.agent()
}
fid = urlparse.parse_qs(urlparse.urlparse(url).query)['v'][0]
pid = urlparse.parse_qs(urlparse.urlparse(url).query)['pid'][0]
url = 'http://www.zoomtv.me/embed.php?v=%s&vw=650&vh=450'%fid
pageUrl = url
#get desktop stream
#headers.update({ 'User-Agent' : 'Apple-iPhone/701.341' })
post_data = urllib.urlencode({'uagent':'Apple-iPhone/701.341', 'pid':pid})
result = req(url,post_data,headers)
log(result)
rtmp = re.findall('.*[^\w](\w+)\s*=.{0,20}(rtmp[^\']*).*(?:streamer.{0,20}\1).*',result)[0]
#for HQ links(no rtmp)
if rtmp is None:
return streamer + '|%s' % urllib.urlencode({'user-agent':client.agent(),'Referer':referer})
url = rtmp + ' playpath=' + file + ' swfUrl=http://static.zoomtv.me/player/jwplayer.6.7.4.swf flashver=' +constants.flash_ver() + ' conn=S:' + file + ' conn=S:'+ts+' conn=S:'+sg+' conn=S:'+auth+' live=1 timeout=15 token=H69d331eccdf347b swfVfy=1 pageUrl=' + pageUrl
return url
开发者ID:msousinha,项目名称:myhome-repository,代码行数:34,代码来源:zoomtv.py
注:本文中的urlparse.parse_qs函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论