def get_posts(headers, model_id): with Revolution(desc='Getting posts...') as _: pinned_posts = posts.scrape_pinned_posts(headers, model_id) timeline_posts = posts.scrape_timeline_posts(headers, model_id) archived_posts = posts.scrape_archived_posts(headers, model_id) return pinned_posts + timeline_posts + archived_posts
def get_models(headers, subscribe_count) -> list: """ Get user's subscriptions in form of a list. """ with Revolution( desc='Getting your subscriptions (this may take awhile)...') as _: list_subscriptions = asyncio.run( subscriptions.get_subscriptions(headers, subscribe_count)) parsed_subscriptions = subscriptions.parse_subscriptions( list_subscriptions) return parsed_subscriptions
def unlike(headers, model_id, username, ids: list): with Revolution(desc='Unliking posts...', total=len(ids)) as rev: for i in ids: with httpx.Client(http2=True, headers=headers) as c: r = c.post(favoriteEP.format(i, model_id)) if not r.is_error: rev.update() else: print( f'{r.status_code} STATUS CODE: unable to unlike post at {postURL.format(i, username)}' ) time.sleep(random.uniform(0.8, 0.9))
def like(headers, model_id, username, ids: list): with Revolution(desc='Liking posts...', total=len(ids)) as rev: for i in ids: with httpx.Client(http2=True, headers=headers) as c: url = favoriteEP.format(i, model_id) auth.add_cookies(c) c.headers.update(auth.create_sign(url, headers)) r = c.post(url) if not r.is_error: rev.update() else: print( f'{r.status_code} STATUS CODE: unable to like post at {postURL.format(i, username)}' ) time.sleep(random.uniform(0.8, 0.9))