Last active
January 27, 2016 23:53
-
-
Save raphaelschaad/5c377caa55a752109960 to your computer and use it in GitHub Desktop.
Massive flipping of multiple URLs into a Flipboard magazine.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#coding=utf-8 | |
# | |
# massive-flipper.py | |
# | |
# Massive flipping of multiple URLs into a Flipboard magazine. | |
# | |
# Created by Raphael Schaad on 2014-09. | |
# This is free and unencumbered software released into the public domain. | |
# | |
# Usage: tweak variables, then just $ python massive-flipper.py | |
# | |
import uuid | |
import requests | |
base_url = 'https://fbprod.flipboard.com/v1/' | |
udid = uuid.uuid4() | |
tuuid = uuid.uuid4() | |
userid = 0 | |
ver = '2.0' | |
base_params = {'udid': udid, 'tuuid': tuuid, 'userid': userid, 'ver': ver} | |
username = 'raphael' | |
password = '<INSERT PASSWORD>' | |
login_params = base_params.copy() | |
login_params.update({'username': username, 'password': password}) | |
login_request = requests.get(base_url + 'flipboard/login/' + str(userid), params=login_params) | |
if login_request.status_code == 200: | |
userid = login_request.json()['userid'] | |
if userid != 0: | |
print('Successfully logged in user with id ' + str(userid)) | |
base_params.update({'userid': userid}) | |
# Look for 'magazineTarget' | |
# mags_params = base_params.copy() | |
# mags_params.update({'ownerid': userid}) | |
# mags_request = requests.get(base_url + 'curator/magazines/' + str(userid), params=mags_params) | |
# print(mags_request.json()) | |
target = 'flipboard/mag-vtYwy%252DN_RaKbD0SMTSWk5Q%3Am%3A1625447' | |
share_params = base_params.copy() | |
share_params.update({'target': target}) | |
# From 181 to 000 | |
for i in reversed(range(0, 182)): | |
s = '%03d' % i | |
url = 'http://thestandardsmanual.com/images/large/nycta_gsm_' + s + '.jpg' | |
text = str(i + 1) + ' of 182' | |
share_params.update({'url': url, 'text': text}) | |
share_request = requests.post(base_url + 'social/shareWithComment/' + str(userid), params=share_params) | |
if share_request.status_code == 200: | |
print('Successfully flipped ' + url) | |
# print(share_request.url) | |
# print(share_request.text) | |
else: | |
print('Failed flipping ' + url) | |
else: | |
print('Login failed: userid is 0') | |
else: | |
print('Login failed: status code is not 200') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment