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

This commit is contained in:
Mike Fährmann
2019-03-06 10:26:01 +01:00
parent 56e0e92e0d
commit efd104e45e

View File

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