https://github.com/itssme/pypr0
Crawls back x days of /top and then shows some statistics about them using the pip statistics
package.
Then they are inserted into the database using the db manager and some select statements are demonstrated.
Crawls all posts with the tag schmuserkadser
and then starts downloading them until the user presses ctrl+c or all posts are downloaded.
from pr0gramm import *
api = Api()
Without login some request will fail (for example: getting comments, the inbox etc.)
api = Api("username", "password")
api.get_newest_image()
This is done because now the json string returned by Api.get_newest_image()
is parsed.
Post(api.get_newest_image())
And we can access all its attributes
Post(api.get_newest_image()).keys()
>> dict_keys(['up', 'gift', 'flags', 'width', 'thumb', 'fullsize', 'image', 'audio', 'source', 'promoted', 'down', 'mark', 'height', 'created', 'user', 'userId', 'id'])
Post(api.get_newest_image())["id"]
>> 1234566789
post = Post(api.get_newest_image(promoted=1))
print(post["up"]-post["down"])
>> 12345
Beware: This will use a flag of 1
which means that only publicly available posts tagged swf (not nsfp) will be used.