Exemplo n.º 1
0
def post_test():
    """
    Test if getting post data works
    :return: nothing, it will error if something goes wrong
    :rtype: None
    """
    logger.info("Running post_test()")
    example_post = ifl.Post("KDI1pd1g7")
    # does it pull info correctly
    # print(example_post.raw_data)
    # pprint(example_post.cdata)
    assert example_post.cdata['publish_at'] == 1590010680
    assert example_post.creator_name == 'I_love_weed_'
    # print(example_post.raw_data["data"]["fixed_title"])

    # does it work with a url
    example_post = ifl.post_from_url(
        "https://ifunny.co/picture/if-wendys-doesn-t-like-this-tweet-within-1-hour-KDI1pd1g7"
    )
    assert example_post.cdata['publish_at'] == 1590010680

    # does it work with an id
    example_post = ifl.post_from_id("KDI1pd1g7")
    assert example_post.cdata['publish_at'] == 1590010680
    # print(example_post.stats)

    print("post_test works")
Exemplo n.º 2
0
def get_author_id():
    logger.info("Running get_author_id()")
    link_id = ifl.get_author_id('https://ifunny.co/user/Scum')
    # print(link_id)
    temp_post = ifl.post_from_url(
        'https://ifunny.co/picture/dorit-girlfriend-ordering-my-starbucks-drink-XW5wI8bt7?gallery=user&query=Scum'
    )
    print(temp_post.creator_id)
    searched = ifl.get_author_id("scum", search_limit=3)
    assert link_id == temp_post.creator_id == searched[0][0]
    print("All three methods to get author id give the same id")
Exemplo n.º 3
0
def main():
    ifl.load_auths(email="*****@*****.**", password="******", file='auth_data')
    if not os.path.exists("post_data"):
        print(1, "downloading")
        post = ifl.post_from_url("https://ifunny.co/picture/what-what-what-the-away-f**k-the-f**k-f**k-b9qpWE0E8?gallery=user&query=PieceOfBread")
        post.smiles.tag_only_mode = 'nick'
        post.smiles.load()
        post.store_file('post_data')
    else:
        print(1, "found local")
        post = ifl.Post(file_name='post_data')
    print(2, len(post.smiles.stored_content), [a for a in post.smiles])
def main():
    """
    Uncomment these to have them run to show that they work
    """
    ifl.load_auths()
    goto_dir('Example Data')
    # get_feats()
    # get_comments_from_a_post_in_subfeed()
    # get_subscriptions_of_last_guest()
    thing = ifl.post_from_url("https://ifunny.co/picture/keep-reacting-to-my-memes-and-we-gonna-end-up-5q08lSXx7?gallery=user&query=billowywarcraft")
    # print(thing.id)
    # save_post(thing.id)
    start = time.time()
    archive_user("billowywarcraft")
    print(time.time() - start)
Exemplo n.º 5
0
def comment_comaprison():
    """
    testing testing path to comment and direct comment look up to be identical
    """
    logger.info("Running comment_comparison()")
    response = ifl.post_from_url(
        'https://ifunny.co/video/this-could-have-been-sub-50-AU9c9Rbi7?gallery=user&query=namisboss'
    )
    comment = ifl.api_call(
        f"https://api.ifunny.mobi/v4/content/{response.id}/comments",
        auth=ifl.BASIC_TOKEN)['data']['comments']['items'][0]
    comment_two = ifl.Comment('AU9c9Rbi7', '5edbbfcfe6abce6b205106ec')
    # print(comment_two.raw_data['data']['comment'])
    # print(comment)
    assert comment_two.cdata == comment
    print('Post comments and comment lookup are identical')
    """
    if not os.path.exists(dir):
        os.mkdir(dir)
    os.chdir(dir)
    return


print(
    "With no custom control yet I'm limiting the saves to single posts for now. It will save everything except for the pics from pic comments. Also max speed is about 50 items/s"
)
# url = input("Post Url>")
url = 'https://ifunny.co/picture/imagine-being-so-disgusting-there-have-to-be-laws-to-tjSsxSDC8?gallery=user&query=Kewl'
start = time.time()
ifl.BASIC_TOKEN = "Basic MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTJfTXNPSUozOVEyODphNmMzN2ZmYjY2MWUzNzEzMDEwODQxNzI0ZTVmZTA4ZjUzNGZhMThm"

post = ifl.post_from_url(url)
print("Found post.")
goto_dir("Demo_data")
goto_dir(post.id)

post.comments.load()
print("Loaded Comments")
for a in post.comments:
    a.replies.load()
print("Loaded Replies")
post.repubs.load()
print("Loaded Repubs")
post.smiles.load()
print("Loaded Smiles")

ifl.dl_from_link(post.url, "Content." + post.url.split('.')[-1])