change substack time parsing to misc.time
This commit is contained in:
parent
25caee17d6
commit
3daae5fa1b
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user