1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 18:53:21 +01:00

[deviantart] minimize cookie usage during scraps extraction

(#445)
This commit is contained in:
Mike Fährmann 2019-11-05 17:58:10 +01:00
parent 1a197d2195
commit a437e78620
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -801,6 +801,14 @@ class DeviantartScrapsExtractor(DeviantartExtractorV2):
)
def deviations(self):
# copy self.session
session = self.session.__class__()
for attr in session.__attrs__:
setattr(session, attr, getattr(self.session, attr, None))
# reset cookies in the original session object
self.session.cookies = session.cookies.__class__()
url = self.root + "/_napi/da-user-profile/api/gallery/contents"
params = {
"username" : self.user,
@ -813,7 +821,8 @@ class DeviantartScrapsExtractor(DeviantartExtractorV2):
}
while True:
data = self.request(url, params=params, headers=headers).json()
data = self.request(
url, session=session, params=params, headers=headers).json()
for obj in data["results"]:
yield obj["deviation"]