[instagram] reject more non-user URLs (#180)

pull/183/head
Mike Fährmann 6 years ago
parent 56e0e92e0d
commit efd104e45e
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Leonardo Taccari
# Copyright 2019 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@ -111,7 +112,7 @@ class InstagramExtractor(Extractor):
class InstagramImageExtractor(InstagramExtractor):
"""Extractor for PostPage"""
subcategory = "image"
pattern = r"(?:https?://)?(?:www\.)?instagram\.com/p/([^/]+)/?"
pattern = r"(?:https?://)?(?:www\.)?instagram\.com/p/([^/?&#]+)"
test = (
# GraphImage
("https://www.instagram.com/p/BqvsDleB3lV/", {
@ -175,7 +176,8 @@ class InstagramImageExtractor(InstagramExtractor):
class InstagramUserExtractor(InstagramExtractor):
"""Extractor for ProfilePage"""
subcategory = "user"
pattern = r"(?:https?://)?(?:www\.)?instagram\.com/(?!p/)([^/?&#]+)"
pattern = (r"(?:https?://)?(?:www\.)?instagram\.com"
r"/(?!p/|explore/|directory/|accounts/)([^/?&#]+)")
test = ("https://www.instagram.com/instagram/", {
"range": "1-12",
"count": ">= 12",

Loading…
Cancel
Save