1
0

Try to use browsercookie

This commit is contained in:
Jon Michael Aanes 2023-12-11 00:42:51 +01:00
parent 8b96802dd9
commit 2563303896
2 changed files with 5 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import requests_cache
import csv import csv
import datetime import datetime
import io import io
import browsercookie
from frozendict import frozendict from frozendict import frozendict
import playstation import playstation
@ -42,7 +43,9 @@ def extend_csv_file(filename, new_dicts , deduplicate = False):
del csvfile del csvfile
def main(): def main():
session = requests_cache.CachedSession('web_cache') cookiejar = browsercookie.firefox()
exit(1)
session = requests_cache.CachedSession('web_cache', cookies = cookiejar)
for scraper in determine_scrapers(): for scraper in determine_scrapers():
result_rows = list(scraper.scraper(session)) result_rows = list(scraper.scraper(session))
extend_csv_file('output/'+scraper.dataset_name, result_rows, extend_csv_file('output/'+scraper.dataset_name, result_rows,

View File

@ -19,7 +19,7 @@ def scrape_played_last(session):
"Sec-Fetch-Site": "same-site", "Sec-Fetch-Site": "same-site",
"Pragma": "no-cache", "Pragma": "no-cache",
"Cache-Control": "no-cache", "Cache-Control": "no-cache",
"Cookie": secrets.PLAYSTATION_COM_COOKIES, #"Cookie": secrets.PLAYSTATION_COM_COOKIES,
'Accept-Encoding': 'gzip, deflate, br', 'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://library.playstation.com/', 'Referer': 'https://library.playstation.com/',
'Origin': 'https://library.playstation.com', 'Origin': 'https://library.playstation.com',