change substack time parsing to misc.time

This commit is contained in:
Jason Schwarzenberger 2020-11-23 16:46:54 +13:00
parent 25caee17d6
commit 3daae5fa1b

View File

@ -10,6 +10,7 @@ if __name__ == '__main__':
import requests import requests
from datetime import datetime from datetime import datetime
from misc.time import unix
from utils import clean from utils import clean
SUBSTACK_REFERER = 'https://substack.com' SUBSTACK_REFERER = 'https://substack.com'
@ -22,9 +23,6 @@ def api_comments(post_id, base_url):
def api_stories(x, base_url): def api_stories(x, base_url):
return f"{base_url}/api/v1/archive?sort=new&search=&offset=0&limit=100" return f"{base_url}/api/v1/archive?sort=new&search=&offset=0&limit=100"
def unix(date_str):
return int(datetime.strptime(date_str, '%Y-%m-%dT%H:%M:%S.%fZ').timestamp())
def api(route, ref=None, referer=None): def api(route, ref=None, referer=None):
headers = {'Referer': referer} if referer else None headers = {'Referer': referer} if referer else None
try: try: