File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 2121
2222BLOG_NAME_PATTERN = re .compile ('(http://)(\w*)' )
2323BLOG_ID_PATTERN = re .compile ('(tag:blogger.com,1999:blog-)(\w*)' )
24- BLOG_ID2_PATTERN = re .compile ('tag:blogger.com,1999:user-(\d+)\.blog-(\d+)' )
24+ BLOG_ID2_PATTERN = re .compile ('tag:blogger.com,1999:user-g? (\d+)\.blog-(\d+)' )
2525POST_ID_PATTERN = re .compile (
2626 '(tag:blogger.com,1999:blog-)(\w*)(.post-)(\w*)' )
2727PAGE_ID_PATTERN = re .compile (
@@ -43,13 +43,12 @@ def get_blog_id(self):
4343 Returns:
4444 The blog's unique id as a string.
4545 """
46- if self .id .text :
47- match = BLOG_ID_PATTERN .match (self .id .text )
46+ if not self .id .text :
47+ return None
48+ for pattern in BLOG_ID_PATTERN , BLOG_ID2_PATTERN :
49+ match = pattern .match (self .id .text )
4850 if match :
4951 return match .group (2 )
50- else :
51- return BLOG_ID2_PATTERN .match (self .id .text ).group (2 )
52- return None
5352
5453 GetBlogId = get_blog_id
5554
You can’t perform that action at this time.
0 commit comments