From 57e90741b1b4a120b85791424bf0386ba5c4d14e Mon Sep 17 00:00:00 2001 From: Mika <59329994+Avnsx@users.noreply.github.com> Date: Fri, 29 Apr 2022 02:38:45 +0200 Subject: [PATCH] update to version 0.3.3 + fixed https://github.com/Avnsx/fansly/issues/17 notes: seems like they removed filenames from the API; adjusted scraper to no longer give each file a custom name since the data for that is not there anymore --- fansly_scraper.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/fansly_scraper.py b/fansly_scraper.py index df68072..04aa7d2 100644 --- a/fansly_scraper.py +++ b/fansly_scraper.py @@ -265,20 +265,20 @@ def sort_download(filename,filebytes): if previews == 'True': try: if x['access'] != False: - sort_download(x['media']['filename'], sess.get(x['preview']['locations'][0]['location'], headers=headers).content) + sort_download(f"{mycreator}.{x['media']['mimetype'].split('/')[1]}", sess.get(x['preview']['locations'][0]['location'], headers=headers).content) if x['access'] == False: - sort_download(x['preview']['filename'], sess.get(x['preview']['locations'][0]['location'], headers=headers).content) + sort_download(f"{mycreator}.png", sess.get(x['preview']['locations'][0]['location'], headers=headers).content) except:pass # unlocked meda in messages try: locurl=x['media']['locations'][0]['location'] - sort_download(x['media']['filename'], sess.get(locurl, headers=headers).content) + sort_download(f"{mycreator}.{x['media']['mimetype'].split('/')[1]}", sess.get(locurl, headers=headers).content) # unlocked messages without corresponding location url except IndexError: for f in range(0,len(x['media']['variants'])): try: locurl=x['media']['variants'][f]['locations'][0]['location'] - sort_download(x['media']['variants'][f]['filename'], sess.get(locurl, headers=headers).content) + sort_download(f"{mycreator}.{x['media']['mimetype'].split('/')[1]}", sess.get(locurl, headers=headers).content) break except:pass # silently passing locked media in messages pass @@ -309,20 +309,20 @@ def sort_download(filename,filebytes): if previews == 'True': try: if x['access'] != False: - sort_download(x['media']['filename'], sess.get(x['preview']['locations'][0]['location'], headers=headers).content) + sort_download(f"{mycreator}.{x['media']['mimetype'].split('/')[1]}", sess.get(x['preview']['locations'][0]['location'], headers=headers).content) if x['access'] == False: - sort_download(x['preview']['filename'], sess.get(x['preview']['locations'][0]['location'], headers=headers).content) + sort_download(f"{mycreator}.png", sess.get(x['preview']['locations'][0]['location'], headers=headers).content) except:pass # unlocked media try: locurl=x['media']['locations'][0]['location'] - sort_download(x['media']['filename'], sess.get(locurl, headers=headers).content) + sort_download(f"{mycreator}.{x['media']['mimetype'].split('/')[1]}", sess.get(locurl, headers=headers).content) # unlocked media without corresponding location url except IndexError: for f in range(0,len(x['media']['variants'])): try: locurl=x['media']['variants'][f]['locations'][0]['location'] - sort_download(x['media']['variants'][f]['filename'], sess.get(locurl, headers=headers).content) + sort_download(f"{mycreator}.{x['media']['mimetype'].split('/')[1]}", sess.get(locurl, headers=headers).content) break except:pass # silently passing locked media pass @@ -366,5 +366,4 @@ def sort_download(filename,filebytes): print('╔═\n Done! Downloaded '+str(pic_count-1)+' pictures & '+str(vid_count-1)+' videos ('+str(duplicates)+' duplicates declined)\n Saved in directory: "'+full_path+'"\n ✶ Please leave a Star on the GitHub Repository, if you are satisfied! ✶'+f'{12*" "}'+'═╝') -s(120) -exit() +input()