Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
update to version 0.3.3
Browse files Browse the repository at this point in the history
+ fixed #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
  • Loading branch information
Avnsx authored Apr 29, 2022
1 parent 086c522 commit 57e9074
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions fansly_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()

0 comments on commit 57e9074

Please sign in to comment.