File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -707,11 +707,21 @@ class InstagramPostExtractor(InstagramExtractor):
707
707
"""Extractor for an Instagram post"""
708
708
subcategory = "post"
709
709
pattern = (r"(?:https?://)?(?:www\.)?instagram\.com"
710
- r"/(?:[^/?#]+/)?(?:p|tv|reel)/([^/?#]+)" )
710
+ r"/(?:share/()| [^/?#]+/)?(?:p|tv|reel)/([^/?#]+)" )
711
711
example = "https://www.instagram.com/p/abcdefg/"
712
712
713
713
def posts (self ):
714
- return self .api .media (self .item )
714
+ share , shortcode = self .groups
715
+ if share is not None :
716
+ url = text .ensure_http_scheme (self .url )
717
+ headers = {
718
+ "Sec-Fetch-Dest" : "empty" ,
719
+ "Sec-Fetch-Mode" : "navigate" ,
720
+ "Sec-Fetch-Site" : "same-origin" ,
721
+ }
722
+ location = self .request_location (url , headers = headers )
723
+ shortcode = location .split ("/" )[- 2 ]
724
+ return self .api .media (shortcode )
715
725
716
726
717
727
class InstagramRestAPI ():
Original file line number Diff line number Diff line change 277
277
"#class" : instagram .InstagramPostExtractor ,
278
278
},
279
279
280
+ {
281
+ "#url" : "https://www.instagram.com/share/p/BACiUUUYQV" ,
282
+ "#category" : ("" , "instagram" , "post" ),
283
+ "#class" : instagram .InstagramPostExtractor ,
284
+ "shortcode" : "C6q-XdvsU5v" ,
285
+ },
286
+
287
+ {
288
+ "#url" : "https://www.instagram.com/share/reel/BARSSL4rTu" ,
289
+ "#category" : ("" , "instagram" , "post" ),
290
+ "#class" : instagram .InstagramPostExtractor ,
291
+ "shortcode" : "DHbVbT4Jx0c" ,
292
+ }
293
+
280
294
)
You can’t perform that action at this time.
0 commit comments