don't redownload file
This commit is contained in:
parent
d079758203
commit
38db700aca
@ -1,2 +1,7 @@
|
||||
# supeapp.py
|
||||
Supeapp python client
|
||||
# supeapp.py - Supeapp python client
|
||||
|
||||
Since SupeApp/Supe.me/Supe.io has closed so I'm disclosing this publicly.
|
||||
|
||||
SupeApp was a Social Networking app like Snapchat where users (mainly well-known VIP/Models) could post public/private media for free or by paid subscription.
|
||||
To convince free users to buy subscriptions, paid media were displayed blurred and with a "Pay now" dialog on top.
|
||||
The blurring effect was done client-side so I realized a PoC python client to call the API directly and store the clear media.
|
||||
|
12
supeapp.py
12
supeapp.py
@ -8,7 +8,7 @@ API_HEADERS = {
|
||||
'User-Agent': 'okhttp/3.6.0',
|
||||
'Platform-Name': 'Android 8.0.0',
|
||||
'Application-Version': '1.1.2',
|
||||
'Device-Name': 'OnePlus ONEPLUS A3003',
|
||||
'Device-Name': 'OnePlus ONEPLUS A0001',
|
||||
'Authorization': 'Bearer {}'.format(os.environ['SUPE_TOKEN']),
|
||||
'Accept': 'application/vnd.api.v3+json',
|
||||
'Content-Type': 'application/json'
|
||||
@ -26,6 +26,7 @@ def download(media_url, cwd=expanduser("~")):
|
||||
filename = media_url.split("/")[-1]
|
||||
file_path = join(cwd, filename)
|
||||
|
||||
if not os.path.isfile(file_path):
|
||||
r = requests.get(media_url, stream=True)
|
||||
if r.status_code == 403:
|
||||
raise Exception("Access Denied")
|
||||
@ -41,24 +42,23 @@ def get_pubblishers():
|
||||
print(user['id'],user['username'])
|
||||
|
||||
profile_pic = user['_embedded']['profileAsset']['filename']
|
||||
cwd = join("./media",str(user['id']))
|
||||
cwd = join("./media",str(user['username']))
|
||||
if not os.path.isdir(cwd):
|
||||
os.mkdir(cwd)
|
||||
|
||||
download(profile_pic, cwd=cwd)
|
||||
|
||||
get_pubblisher_video(user['id'])
|
||||
get_pubblisher_video(user['id'], cwd)
|
||||
|
||||
|
||||
def get_pubblisher_video(pub_id):
|
||||
def get_pubblisher_video(pub_id, cwd):
|
||||
obj = request("me/inbox/publisher/{}?type=broadcast".format(pub_id), method='GET')
|
||||
posts = obj['_embedded']['items']
|
||||
|
||||
for post in posts:
|
||||
print(post['id'],post['type'],post['caption'])
|
||||
print(post['id'],post['type'])
|
||||
|
||||
media = post['_embedded']['asset']['filename']
|
||||
cwd = join("./media",str(pub_id))
|
||||
if not os.path.isdir(cwd):
|
||||
os.mkdir(cwd)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user