diff --git a/README.md b/README.md index 0fe1b08..f7a5f2c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,10 @@ Surfer SEO, Frase io, ClearScope, NeuronWriter, etc.. (of course they offer more - This is for personal usage, no authentication setup needed in the app itself. - Sign up to [SerpApi](https://serpapi.com) to get FREE Serp search results credit - + + + + ## Status Under heavy development. Not for production. diff --git a/backend-crt/src/db/models.py b/backend-crt/src/db/models.py index 5cc3836..6e756ac 100644 --- a/backend-crt/src/db/models.py +++ b/backend-crt/src/db/models.py @@ -11,6 +11,7 @@ class Post(SQLModel, table=True): search_query: dict = Field(sa_column=Column(JSON)) search_result: dict = Field(sa_column=Column(JSON)) choosen_links: dict = Field(sa_column=Column(JSON)) + links_scrape_result: dict = Field(sa_column=Column(JSON)) createdAt: datetime = Field(default_factory=datetime.utcnow) updatedAt: datetime = Field(default_factory=datetime.utcnow) diff --git a/backend-crt/src/main.py b/backend-crt/src/main.py index afd576c..3f95f55 100644 --- a/backend-crt/src/main.py +++ b/backend-crt/src/main.py @@ -124,8 +124,16 @@ def deletePost(post_id: str): @app.get('/scrape/{post_id}') async def scrape(post_id: str): post = get_post(post_id) - links = post.choosen_links + # Return early if exists + if post.links_scrape_result: + return { + "status": "success", + "data": post.links_scrape_result + } + + # Scrape links if new + links = post.choosen_links lang = post.search_query['hl'] contentInfo = [] @@ -143,13 +151,18 @@ async def scrape(post_id: str): topKeywords = _getTopKeywords(allKeywords) averageWords = sum([content['totalWords'] for content in contentInfo]) / len(contentInfo) + links_scrape_result = { + "contentInfo": contentInfo, + "topKeywords": topKeywords, + "averageWords": averageWords + } + update_post(post_id, { + "links_scrape_result": links_scrape_result + }) + return { "status": "success", - "data": { - "contentInfo": contentInfo, - "topKeywords": topKeywords, - "averageWords": averageWords - } + "data": links_scrape_result } # Currently lang get from hl query parameter diff --git a/frontend-crt/src/components/AddKeyword.tsx b/frontend-crt/src/components/AddKeyword.tsx index 0b1bcea..2c110a0 100644 --- a/frontend-crt/src/components/AddKeyword.tsx +++ b/frontend-crt/src/components/AddKeyword.tsx @@ -63,8 +63,8 @@ export default function AddKeyword() { ) } - -
Add New Content+
+ ) } \ No newline at end of file diff --git a/frontend-crt/src/components/Sidebar.tsx b/frontend-crt/src/components/Sidebar.tsx index b3ca103..a00c999 100644 --- a/frontend-crt/src/components/Sidebar.tsx +++ b/frontend-crt/src/components/Sidebar.tsx @@ -162,13 +162,21 @@ export default function Sidebar({ { menu == 'terms' && ( -Loading ... (Up to 1 minutes)
:Loading ... (Up to 1 minutes)
: