[instagram] use 'itertools.chain()'
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
from .common import Extractor, Message
|
||||
from .. import text, exception
|
||||
from ..cache import cache
|
||||
import itertools
|
||||
import json
|
||||
|
||||
|
||||
@@ -413,6 +414,7 @@ class InstagramSavedExtractor(InstagramExtractor):
|
||||
pattern = (r"(?:https?://)?(?:www\.)?instagram\.com"
|
||||
r"/(?!p/|explore/|directory/|accounts/|stories/|tv/)"
|
||||
r"([^/?&#]+)/saved")
|
||||
test = ("https://www.instagram.com/instagram/saved/",)
|
||||
|
||||
def __init__(self, match):
|
||||
InstagramExtractor.__init__(self, match)
|
||||
@@ -459,10 +461,7 @@ class InstagramUserExtractor(InstagramExtractor):
|
||||
url = '{}/{}/'.format(self.root, self.username)
|
||||
shared_data = self._extract_shared_data(url)
|
||||
|
||||
if self.config('highlights'):
|
||||
yield from self._extract_story_highlights(shared_data)
|
||||
|
||||
yield from self._extract_page(shared_data, {
|
||||
instagrams = self._extract_page(shared_data, {
|
||||
'page': 'ProfilePage',
|
||||
'node': 'user',
|
||||
'node_id': 'id',
|
||||
@@ -471,6 +470,14 @@ class InstagramUserExtractor(InstagramExtractor):
|
||||
'query_hash': 'f2405b236d85e8296cf30347c9f08c2a',
|
||||
})
|
||||
|
||||
if self.config('highlights'):
|
||||
instagrams = itertools.chain(
|
||||
self._extract_story_highlights(shared_data),
|
||||
instagrams,
|
||||
)
|
||||
|
||||
return instagrams
|
||||
|
||||
|
||||
class InstagramChannelExtractor(InstagramExtractor):
|
||||
"""Extractor for ProfilePage channel"""
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
|
||||
__version__ = "1.13.2"
|
||||
__version__ = "1.13.3-dev"
|
||||
|
||||
Reference in New Issue
Block a user