escape strings
This commit is contained in:
parent
ae10c5c9b9
commit
41edea1862
20 changed files with 74 additions and 74 deletions
|
|
@ -11,7 +11,7 @@ def get_ids():
|
|||
for i in string.ascii_uppercase:
|
||||
url = "http://www.filmsdivision.org/search.php?title=%s" % i
|
||||
data = ox.cache.read_url(url)
|
||||
links = re.compile('view_video.php\?movId=(.*?)[\'"]', re.DOTALL).findall(data)
|
||||
links = re.compile(r'view_video.php\?movId=(.*?)[\'"]', re.DOTALL).findall(data)
|
||||
result += links
|
||||
return list(set(result))
|
||||
|
||||
|
|
@ -20,20 +20,20 @@ def get_data(id):
|
|||
url = "http://www.filmsdivision.org/view_video.php?movId=%s" % id
|
||||
data = ox.cache.read_url(url)
|
||||
result['title'] = re.compile('<td.*?class="vdoheadtxt".*?>(.*?)</td>').findall(data)[0]
|
||||
result['year'] = re.compile('Release: (\d{4})').findall(data)[0]
|
||||
result['duration'] = int(re.compile('Duration: (\d+)mins').findall(data)[0]) * 60
|
||||
result['producer'] = re.compile('Producer: (.*?)\t').findall(data)[0].strip()
|
||||
result['year'] = re.compile(r'Release: (\d{4})').findall(data)[0]
|
||||
result['duration'] = int(re.compile(r'Duration: (\d+)mins').findall(data)[0]) * 60
|
||||
result['producer'] = re.compile(r'Producer: (.*?)\t').findall(data)[0].strip()
|
||||
if 'Director:' in data:
|
||||
result['director'] = re.compile('Director: (.*?)\t').findall(data)[0].strip()
|
||||
result['director'] = re.compile(r'Director: (.*?)\t').findall(data)[0].strip()
|
||||
else:
|
||||
result['director'] = "Unknown Director"
|
||||
result['url'] = re.compile('value="(.*?.wmv)"').findall(data)[0]
|
||||
result['url'] = re.compile(r'value="(.*?.wmv)"').findall(data)[0]
|
||||
return result
|
||||
|
||||
def download_video(url, filename):
|
||||
dirname = os.path.dirname(filename)
|
||||
if not os.path.exists(dirname):
|
||||
os.makedirs(dirname)
|
||||
p = subprocess.Popen(['gst-launch', 'mmssrc', 'location=%s'%url, '!', 'filesink', 'locaiton='%filename])
|
||||
p = subprocess.Popen(['gst-launch', 'mmssrc', 'location=%s' % url, '!', 'filesink', 'location=' % filename])
|
||||
p.wait()
|
||||
return p.returncode == 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue