[instagram] use 'itertools.chain()'

pull/658/head
Mike Fährmann 5 years ago
parent 160328d21c
commit 90d15e3682
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -1,5 +1,7 @@
# Changelog
## Unreleased
## 1.13.2 - 2020-03-14
### Additions
- [furaffinity] extract more metadata

@ -146,7 +146,7 @@ Turboimagehost https://www.turboimagehost.com/ individual Images
.. |flickr-C| replace:: Albums, Favorites, Galleries, Groups, individual Images, Search Results, User Profiles
.. |hentaifoundry-C| replace:: Favorites, individual Images, Popular Images, Recent Images, Scraps, User Profiles
.. |imgur-C| replace:: Albums, Favorites, Galleries, individual Images, Subreddits, User Profiles
.. |instagram-C| replace:: Channels, individual Images, Stories, Tag-Searches, User Profiles
.. |instagram-C| replace:: Channels, individual Images, Saved Posts, Stories, Tag-Searches, User Profiles
.. |newgrounds-C| replace:: Art, Audio, Favorites, individual Images, Media Files, Movies, User Profiles
.. |nijie-C| replace:: Doujin, Favorites, individual Images, User Profiles
.. |pixiv-C| replace:: Favorites, Follows, pixiv.me Links, Rankings, Search Results, User Profiles, individual Images

@ -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"

@ -109,6 +109,9 @@ SUBCATEGORY_MAP = {
"deviantart": {
"stash": "Sta.sh",
},
"instagram": {
"saved": "Saved Posts",
},
"newgrounds": {
"art" : "Art",
"audio": "Audio",

Loading…
Cancel
Save