[instagram] use 'reel' subcategory for '/reel/CODE' URLs (#8274)
This commit is contained in:
@@ -453,11 +453,16 @@ class InstagramPostExtractor(InstagramExtractor):
|
||||
"""Extractor for an Instagram post"""
|
||||
subcategory = "post"
|
||||
pattern = (r"(?:https?://)?(?:www\.)?instagram\.com"
|
||||
r"/(?:share/()|[^/?#]+/)?(?:p|tv|reels?)/([^/?#]+)")
|
||||
r"/(?:share/()|[^/?#]+/)?(?:p|tv|reels?())/([^/?#]+)")
|
||||
example = "https://www.instagram.com/p/abcdefg/"
|
||||
|
||||
def __init__(self, match):
|
||||
if match[2] is not None:
|
||||
self.subcategory = "reel"
|
||||
InstagramExtractor.__init__(self, match)
|
||||
|
||||
def posts(self):
|
||||
share, shortcode = self.groups
|
||||
share, reel, shortcode = self.groups
|
||||
if share is not None:
|
||||
url = text.ensure_http_scheme(self.url)
|
||||
headers = {
|
||||
|
||||
@@ -278,12 +278,13 @@ __tests__ = (
|
||||
|
||||
{
|
||||
"#url" : "https://www.instagram.com/reel/CDg_6Y1pxWu/",
|
||||
"#category": ("", "instagram", "post"),
|
||||
"#category": ("", "instagram", "reel"),
|
||||
"#class" : instagram.InstagramPostExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.instagram.com/reels/CDg_6Y1pxWu/",
|
||||
"#category": ("", "instagram", "reel"),
|
||||
"#class" : instagram.InstagramPostExtractor,
|
||||
},
|
||||
|
||||
@@ -296,7 +297,7 @@ __tests__ = (
|
||||
|
||||
{
|
||||
"#url" : "https://www.instagram.com/share/reel/BARSSL4rTu",
|
||||
"#category": ("", "instagram", "post"),
|
||||
"#category": ("", "instagram", "reel"),
|
||||
"#class" : instagram.InstagramPostExtractor,
|
||||
"shortcode" : "DHbVbT4Jx0c",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user