[instagram] support '/share/SHORTCODE' URLs (#8340)
i.e. "bare" /share/ links
This commit is contained in:
@@ -436,7 +436,8 @@ class InstagramExtractor(Extractor):
|
||||
return cursor
|
||||
|
||||
def _update_cursor(self, cursor):
|
||||
self.log.debug("Cursor: %s", cursor)
|
||||
if cursor:
|
||||
self.log.debug("Cursor: %s", cursor)
|
||||
self._cursor = cursor
|
||||
return cursor
|
||||
|
||||
@@ -461,16 +462,18 @@ 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?()))?"
|
||||
r"|(?:[^/?#]+/)?(?:p|tv|reels?()))"
|
||||
r"/([^/?#]+)")
|
||||
example = "https://www.instagram.com/p/abcdefg/"
|
||||
|
||||
def __init__(self, match):
|
||||
if match[2] is not None:
|
||||
if match[2] is not None or match[3] is not None:
|
||||
self.subcategory = "reel"
|
||||
InstagramExtractor.__init__(self, match)
|
||||
|
||||
def posts(self):
|
||||
share, reel, shortcode = self.groups
|
||||
share, _, _, shortcode = self.groups
|
||||
if share is not None:
|
||||
url = text.ensure_http_scheme(self.url)
|
||||
headers = {
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
|
||||
__version__ = "1.30.9"
|
||||
__version__ = "1.31.0-dev"
|
||||
__variant__ = None
|
||||
|
||||
@@ -288,6 +288,13 @@ __tests__ = (
|
||||
"#class" : instagram.InstagramPostExtractor,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.instagram.com/share/BACiUUUYQV",
|
||||
"#category": ("", "instagram", "post"),
|
||||
"#class" : instagram.InstagramPostExtractor,
|
||||
"shortcode" : "C6q-XdvsU5v",
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.instagram.com/share/p/BACiUUUYQV",
|
||||
"#category": ("", "instagram", "post"),
|
||||
|
||||
Reference in New Issue
Block a user