Skip to content

Commit

Permalink
[weibo] fix AttributeError in 'user' extractor (#5022)
Browse files Browse the repository at this point in the history
yet another bug caused by a383eca
  • Loading branch information
mikf committed Jan 5, 2024
1 parent 0ab0a10 commit b4bcf40
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 10 deletions.
3 changes: 0 additions & 3 deletions gallery_dl/extractor/weibo.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,6 @@ class WeiboUserExtractor(WeiboExtractor):
pattern = USER_PATTERN + r"(?:$|#)"
example = "https://weibo.com/USER"

def initialize(self):
pass

def items(self):
base = "{}/u/{}?tabtype=".format(self.root, self._user_id())
return self._dispatch_extractors((
Expand Down
47 changes: 40 additions & 7 deletions test/results/weibo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,35 @@
"#url" : "https://weibo.com/1758989602",
"#category": ("", "weibo", "user"),
"#class" : weibo.WeiboUserExtractor,
"#pattern" : r"^https://weibo\.com/u/1758989602\?tabtype=feed$",
"#urls" : "https://weibo.com/u/1758989602?tabtype=feed",
},

{
"#url" : "https://weibo.com/1758989602",
"#category": ("", "weibo", "user"),
"#class" : weibo.WeiboUserExtractor,
"#options" : {"include": "all"},
"#urls" : (
"https://weibo.com/u/1758989602?tabtype=home",
"https://weibo.com/u/1758989602?tabtype=feed",
"https://weibo.com/u/1758989602?tabtype=video",
"https://weibo.com/u/1758989602?tabtype=newVideo",
"https://weibo.com/u/1758989602?tabtype=album",
),
},

{
"#url" : "https://weibo.com/zhouyuxi77",
"#category": ("", "weibo", "user"),
"#class" : weibo.WeiboUserExtractor,
"#urls" : "https://weibo.com/u/7488709788?tabtype=feed",
},

{
"#url" : "https://www.weibo.com/n/周于希Sally",
"#category": ("", "weibo", "user"),
"#class" : weibo.WeiboUserExtractor,
"#urls" : "https://weibo.com/u/7488709788?tabtype=feed",
},

{
Expand Down Expand Up @@ -69,9 +97,11 @@
"#class" : weibo.WeiboFeedExtractor,
"#range" : "1",

"status": {"user": {
"id" : 7488709788,
}},
"status": {
"user": {
"id": 7488709788,
},
},
},

{
Expand All @@ -80,9 +110,12 @@
"#class" : weibo.WeiboFeedExtractor,
"#range" : "1",

"status": {"user": {
"id" : 7488709788,
}},

"status": {
"user": {
"id": 7488709788,
},
},
},

{
Expand Down

0 comments on commit b4bcf40

Please sign in to comment.