[weibo] support '?tabtype=video' listings (#2601)
This commit is contained in:
@@ -2489,7 +2489,7 @@ Description
|
|||||||
when processing a user profile.
|
when processing a user profile.
|
||||||
|
|
||||||
Possible values are
|
Possible values are
|
||||||
``"home"``, ``"feed"``, ``"videos"``, ``"article"``, ``"album"``.
|
``"home"``, ``"feed"``, ``"videos"``, ``"newvideo"``, ``"article"``, ``"album"``.
|
||||||
|
|
||||||
It is possible to use ``"all"`` instead of listing all values separately.
|
It is possible to use ``"all"`` instead of listing all values separately.
|
||||||
|
|
||||||
|
|||||||
@@ -191,7 +191,9 @@ class WeiboUserExtractor(WeiboExtractor):
|
|||||||
subcategory = "user"
|
subcategory = "user"
|
||||||
pattern = USER_PATTERN + r"(?:$|#)"
|
pattern = USER_PATTERN + r"(?:$|#)"
|
||||||
test = (
|
test = (
|
||||||
("https://weibo.com/1758989602"),
|
("https://weibo.com/1758989602", {
|
||||||
|
"pattern": r"^https://weibo\.com/u/1758989602\?tabtype=feed$",
|
||||||
|
}),
|
||||||
("https://weibo.com/u/1758989602"),
|
("https://weibo.com/u/1758989602"),
|
||||||
("https://weibo.com/p/1758989602"),
|
("https://weibo.com/p/1758989602"),
|
||||||
("https://m.weibo.cn/profile/2314621010"),
|
("https://m.weibo.cn/profile/2314621010"),
|
||||||
@@ -202,10 +204,11 @@ class WeiboUserExtractor(WeiboExtractor):
|
|||||||
def items(self):
|
def items(self):
|
||||||
base = "{}/u/{}?tabtype=".format(self.root, self._user_id())
|
base = "{}/u/{}?tabtype=".format(self.root, self._user_id())
|
||||||
return self._dispatch_extractors((
|
return self._dispatch_extractors((
|
||||||
(WeiboHomeExtractor , base + "home"),
|
(WeiboHomeExtractor , base + "home"),
|
||||||
(WeiboFeedExtractor , base + "feed"),
|
(WeiboFeedExtractor , base + "feed"),
|
||||||
(WeiboVideosExtractor, base + "newVideo"),
|
(WeiboVideosExtractor , base + "video"),
|
||||||
(WeiboAlbumExtractor , base + "album"),
|
(WeiboNewvideoExtractor, base + "newVideo"),
|
||||||
|
(WeiboAlbumExtractor , base + "album"),
|
||||||
), ("feed",))
|
), ("feed",))
|
||||||
|
|
||||||
|
|
||||||
@@ -254,8 +257,27 @@ class WeiboFeedExtractor(WeiboExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class WeiboVideosExtractor(WeiboExtractor):
|
class WeiboVideosExtractor(WeiboExtractor):
|
||||||
"""Extractor for weibo 'newVideo' listings"""
|
"""Extractor for weibo 'video' listings"""
|
||||||
subcategory = "videos"
|
subcategory = "videos"
|
||||||
|
pattern = USER_PATTERN + r"\?tabtype=video"
|
||||||
|
test = ("https://weibo.com/1758989602?tabtype=video", {
|
||||||
|
"pattern": r"https://f\.(video\.weibocdn\.com|us\.sinaimg\.cn)"
|
||||||
|
r"/(../)?\w+\.mp4\?label=mp",
|
||||||
|
"range": "1-30",
|
||||||
|
"count": 30,
|
||||||
|
})
|
||||||
|
|
||||||
|
def statuses(self):
|
||||||
|
endpoint = "/profile/getprofilevideolist"
|
||||||
|
params = {"uid": self._user_id()}
|
||||||
|
|
||||||
|
for status in self._pagination(endpoint, params):
|
||||||
|
yield status["video_detail_vo"]
|
||||||
|
|
||||||
|
|
||||||
|
class WeiboNewvideoExtractor(WeiboExtractor):
|
||||||
|
"""Extractor for weibo 'newVideo' listings"""
|
||||||
|
subcategory = "newvideo"
|
||||||
pattern = USER_PATTERN + r"\?tabtype=newVideo"
|
pattern = USER_PATTERN + r"\?tabtype=newVideo"
|
||||||
test = ("https://weibo.com/1758989602?tabtype=newVideo", {
|
test = ("https://weibo.com/1758989602?tabtype=newVideo", {
|
||||||
"pattern": r"https://f\.video\.weibocdn\.com/(../)?\w+\.mp4\?label=mp",
|
"pattern": r"https://f\.video\.weibocdn\.com/(../)?\w+\.mp4\?label=mp",
|
||||||
@@ -336,8 +358,8 @@ class WeiboStatusExtractor(WeiboExtractor):
|
|||||||
}),
|
}),
|
||||||
# type == gif
|
# type == gif
|
||||||
("https://weibo.com/1758989602/LvBhm5DiP", {
|
("https://weibo.com/1758989602/LvBhm5DiP", {
|
||||||
"pattern": r"http://g\.us\.sinaimg.cn/o0/qNZcaAAglx07Wuf921CM01041"
|
"pattern": r"https://g\.us\.sinaimg.cn/o0/qNZcaAAglx07Wuf921CM0104"
|
||||||
r"20005tc0E010\.mp4\?label=gif_mp4",
|
r"120005tc0E010\.mp4\?label=gif_mp4",
|
||||||
}),
|
}),
|
||||||
("https://m.weibo.cn/status/4339748116375525"),
|
("https://m.weibo.cn/status/4339748116375525"),
|
||||||
("https://m.weibo.cn/5746766133/4339748116375525"),
|
("https://m.weibo.cn/5746766133/4339748116375525"),
|
||||||
|
|||||||
@@ -230,6 +230,7 @@ SUBCATEGORY_MAP = {
|
|||||||
},
|
},
|
||||||
"weibo": {
|
"weibo": {
|
||||||
"home": "",
|
"home": "",
|
||||||
|
"newvideo": "",
|
||||||
},
|
},
|
||||||
"wikiart": {
|
"wikiart": {
|
||||||
"artists": "Artist Listings",
|
"artists": "Artist Listings",
|
||||||
|
|||||||
Reference in New Issue
Block a user