Optimize downloading content from server.

sqlite
VikingKong 3 years ago
parent 1cc83ddd2d
commit ac2c76541f

@ -30,7 +30,7 @@ class Fetcher:
if number == 0:
response = httpx.get(self.URL+"/reader/api/0/stream/contents?n=1000"+"&s="+category, headers=self.headers)
else:
response = httpx.get(self.URL+"/reader/api/0/stream/contents?ot="+timestamp+"&s="
response = httpx.get(self.URL+"/reader/api/0/stream/contents?n="+count+"&s="
+ category, headers=self.headers)
return response.json()["items"]

@ -13,6 +13,7 @@ class Cache:
def __init__(self, api):
self.conn = None
self.api = api
file_path = os.path.expanduser("~") + '/.config/inomnibus/cache.db'
create_categories = """create table if not exists categories (
id text primary key,
name text not null,
@ -61,7 +62,7 @@ class Cache:
)
"""
try:
self.conn = sqlite3.connect(os.path.expanduser("~") + '/.config/inomnibus/cache.db')
self.conn = sqlite3.connect(file_path)
self.conn.cursor().execute(create_categories)
self.conn.cursor().execute(create_feeds)
self.conn.cursor().execute(create_articles)
@ -238,7 +239,7 @@ class Cache:
row[0],
count=str(row[2]),
timestamp=timestamp,
number=row[3])
number=str(row[3]))
for article in articles:
articleObj = Article(article)
cur.execute("""insert into articles(id,title,timestamp,date,content,url,is_read,origin,category_id)

Loading…
Cancel
Save