[instagram] remove login support
broken feature that I cannot get to work anymore
This commit is contained in:
@@ -210,7 +210,6 @@ and optional for
|
||||
``idolcomplex``,
|
||||
``imgbb``,
|
||||
``inkbunny``,
|
||||
``instagram``,
|
||||
``mangadex``,
|
||||
``mangoxo``,
|
||||
``pillowfort``,
|
||||
|
||||
@@ -377,7 +377,6 @@ Description
|
||||
* ``idolcomplex``
|
||||
* ``imgbb``
|
||||
* ``inkbunny``
|
||||
* ``instagram``
|
||||
* ``kemonoparty``
|
||||
* ``mangadex``
|
||||
* ``mangoxo``
|
||||
|
||||
@@ -395,7 +395,7 @@ Consider all sites to be NSFW unless otherwise known.
|
||||
<td>Instagram</td>
|
||||
<td>https://www.instagram.com/</td>
|
||||
<td>Avatars, Collections, Highlights, Posts, Reels, Saved Posts, Stories, Tag Searches, Tagged Posts, User Profiles</td>
|
||||
<td>Supported</td>
|
||||
<td><a href="https://github.com/mikf/gallery-dl#cookies">Cookies</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Issuu</td>
|
||||
|
||||
@@ -14,7 +14,6 @@ from .. import text, util, exception
|
||||
from ..cache import cache, memcache
|
||||
import binascii
|
||||
import json
|
||||
import time
|
||||
import re
|
||||
|
||||
BASE_PATTERN = r"(?:https?://)?(?:www\.)?instagram\.com"
|
||||
@@ -975,63 +974,9 @@ class InstagramGraphqlAPI():
|
||||
|
||||
@cache(maxage=90*24*3600, keyarg=1)
|
||||
def _login_impl(extr, username, password):
|
||||
extr.log.info("Logging in as %s", username)
|
||||
|
||||
user_agent = ("Mozilla/5.0 (Linux; Android 13) AppleWebKit/537.36 "
|
||||
"(KHTML, like Gecko) Chrome/106.0.5249.79 Mobile "
|
||||
"Safari/537.36 Instagram 255.1.0.17.102")
|
||||
|
||||
headers = {
|
||||
"User-Agent" : user_agent,
|
||||
"Sec-Fetch-Dest": "document",
|
||||
"Sec-Fetch-Mode": "navigate",
|
||||
"Sec-Fetch-Site": "none",
|
||||
"Sec-Fetch-User": "?1",
|
||||
}
|
||||
url = extr.root + "/accounts/login/"
|
||||
response = extr.request(url, headers=headers)
|
||||
|
||||
extract = text.extract_from(response.text)
|
||||
csrf_token = extract('"csrf_token":"', '"')
|
||||
device_id = extract('"device_id":"', '"')
|
||||
rollout_hash = extract('"rollout_hash":"', '"')
|
||||
|
||||
cset = extr.session.cookies.set
|
||||
cset("csrftoken", csrf_token, domain=extr.cookiedomain)
|
||||
cset("ig_did", device_id, domain=extr.cookiedomain)
|
||||
|
||||
headers = {
|
||||
"User-Agent" : user_agent,
|
||||
"Accept" : "*/*",
|
||||
"X-CSRFToken" : csrf_token,
|
||||
"X-Instagram-AJAX": rollout_hash,
|
||||
"X-IG-App-ID" : "936619743392459",
|
||||
"X-ASBD-ID" : "198387",
|
||||
"X-IG-WWW-Claim" : "0",
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
"Origin" : extr.root,
|
||||
"Referer" : url,
|
||||
"Sec-Fetch-Dest" : "empty",
|
||||
"Sec-Fetch-Mode" : "cors",
|
||||
"Sec-Fetch-Site" : "same-origin",
|
||||
}
|
||||
data = {
|
||||
"enc_password" : "#PWD_INSTAGRAM_BROWSER:0:{}:{}".format(
|
||||
int(time.time()), password),
|
||||
"username" : username,
|
||||
"queryParams" : "{}",
|
||||
"optIntoOneTap" : "false",
|
||||
"stopDeletionNonce" : "",
|
||||
"trustedDeviceRecords": "{}",
|
||||
}
|
||||
url = extr.root + "/accounts/login/ajax/"
|
||||
response = extr.request(url, method="POST", headers=headers, data=data)
|
||||
|
||||
if not response.json().get("authenticated"):
|
||||
raise exception.AuthenticationError()
|
||||
|
||||
return {cookie.name: cookie.value
|
||||
for cookie in extr.session.cookies}
|
||||
extr.log.error("Login with username & password is no longer supported. "
|
||||
"Use browser cookies instead.")
|
||||
return {}
|
||||
|
||||
|
||||
def id_from_shortcode(shortcode):
|
||||
|
||||
@@ -287,7 +287,7 @@ AUTH_MAP = {
|
||||
"idolcomplex" : "Supported",
|
||||
"imgbb" : "Supported",
|
||||
"inkbunny" : "Supported",
|
||||
"instagram" : "Supported",
|
||||
"instagram" : _COOKIES,
|
||||
"kemonoparty" : "Supported",
|
||||
"mangadex" : "Supported",
|
||||
"mangoxo" : "Supported",
|
||||
|
||||
Reference in New Issue
Block a user