Skip to content

Commit

Permalink
[pinterest] remove login code
Browse files Browse the repository at this point in the history
this has been broken since forever
and is still "protected" by an invisible recaptcha check
  • Loading branch information
mikf committed Dec 20, 2023
1 parent 92ff99c commit 75fa1a5
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions gallery_dl/extractor/pinterest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from .common import Extractor, Message
from .. import text, util, exception
from ..cache import cache
import itertools

BASE_PATTERN = r"(?:https?://)?(?:\w+\.)?pinterest\.[\w.]+"
Expand All @@ -33,7 +32,6 @@ def _init(self):
self.api = PinterestAPI(self)

def items(self):
self.api.login()
data = self.metadata()
videos = self.config("videos", True)

Expand Down Expand Up @@ -416,41 +414,6 @@ def search(self, query):
options = {"query": query, "scope": "pins", "rs": "typed"}
return self._pagination("BaseSearch", options)

def login(self):
"""Login and obtain session cookies"""
username, password = self.extractor._get_auth_info()
if username:
self.cookies.update(self._login_impl(username, password))

@cache(maxage=180*86400, keyarg=1)
def _login_impl(self, username, password):
self.extractor.log.info("Logging in as %s", username)

url = self.root + "/resource/UserSessionResource/create/"
options = {
"username_or_email": username,
"password" : password,
}
data = {
"data" : util.json_dumps({"options": options}),
"source_url": "",
}

try:
response = self.extractor.request(
url, method="POST", headers=self.headers,
cookies=self.cookies, data=data)
resource = response.json()["resource_response"]
except (exception.HttpError, ValueError, KeyError):
raise exception.AuthenticationError()

if resource["status"] != "success":
raise exception.AuthenticationError()
return {
cookie.name: cookie.value
for cookie in response.cookies
}

def _call(self, resource, options):
url = "{}/resource/{}Resource/get/".format(self.root, resource)
params = {
Expand Down

0 comments on commit 75fa1a5

Please sign in to comment.