This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
import urllib2 | |
from base64 import b64encode | |
from BeautifulSoup import BeautifulStoneSoup | |
Help = """A tool for fetch flvxz.com video URL parse result. | |
Usage: flvxz.py [url] | |
""" | |
Query_URL = 'http://api.flvxz.com/url/{0}' | |
try: | |
url = Query_URL.format(b64encode(sys.argv[1])) | |
except IndexError: | |
print Help | |
sys.exit(1) | |
xml = urllib2.urlopen(url).read() | |
soup = BeautifulStoneSoup(xml) | |
for video in soup.findAll('video'): | |
title = u'' | |
for c in video.title.text.split('\\u'): | |
if not c: | |
continue | |
title += unichr(int(c, 16)) | |
quality = video.quality.text | |
ftype = video.ftype.text | |
furl = video.furl.text | |
print '[{0}] {2}.{1}'.format(quality, ftype, title) | |
print furl |
沒有留言:
張貼留言