Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed issue 1: Unable to get the title of some pages & Now version 3.

  • Loading branch information...
commit 6d8049134facd333f007c55d964915a72c64cd2c 1 parent 8fecfb3
ydoovv ydoovv authored
Showing with 3 additions and 3 deletions.
  1. +1 −1  app.yaml
  2. +2 −2 freejump.py
2  app.yaml
View
@@ -1,5 +1,5 @@
application: digest-favs
-version: 2
+version: 3
runtime: python
api_version: 1
4 freejump.py
View
@@ -29,12 +29,12 @@ def get_title(self, url):
f = urlopen(url)
for i in range(4): # no 'title' tag in the beginning 4k of a page? WTF
res = f.read(1024)
- title_raw = re.findall('<title>.*</title>', res)
+ title_raw = re.findall('<title>.*</title>', res, flags=re.DOTALL)
if title_raw: break
if i == 3: return "No title found in your web page..."
- title = title_raw[0][7:-8] # strip 'title' tag
+ title = title_raw[0][7:-8].strip() # strip 'title' tag & '\n', '\t'...
for enc in ("utf-8", "gbk", "big5"):
try:
t = title.decode(enc)
Please sign in to comment.
Something went wrong with that request. Please try again.