import requests import json import os import readme debug = False def get_image_name(url): return url.split("/")[-1] def get_page_url(url, after): return url + "?sort=hot&t=&after=t3_" + after def get_full_url(libreddit_instance, url): return libreddit_instance + url def get_subreddit_full_url(libreddit_instance, subreddit): return libreddit_instance + "/r/" + subreddit def get_posts_ids_in_page(page_content): posts = [] posts_html = re.findall(r"(\
)", page_content) for post_html in posts_html: posts.append(re.search(r"\w{6,7}", post_html).group()) return posts def get_single_videos_in_page(page_content): videos_url = [] videos_html = re.findall(r"(\