Skip to content

Commit 480c3e5

Browse files
committed
Remove manual buttons trigger search as it is done automatically now
1 parent 081338d commit 480c3e5

File tree

6 files changed

+14
-205
lines changed

6 files changed

+14
-205
lines changed

backend/api_app/controllers/apps.py

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,6 @@ def process_search_results(results: list[dict]) -> None:
8181
logger.info("search results done")
8282

8383

84-
def get_playstore_results(search_term: str) -> AppGroup:
85-
"""Parse search term and return resulting APpGroup."""
86-
decoded_input = urllib.parse.unquote(search_term)
87-
df = search_apps(search_input=decoded_input, limit=20)
88-
logger.info(f"{decoded_input=} returned rows: {df.shape[0]}")
89-
apps_dict = df.to_dict(orient="records")
90-
app_group = AppGroup(title=search_term, apps=apps_dict)
91-
return app_group
92-
93-
9484
def app_history(store_app: int, app_name: str) -> AppHistory:
9585
"""Get the history of app scraping."""
9686
app_hist = get_app_history(store_app)
@@ -618,63 +608,6 @@ async def search(self: Self, search_term: str) -> AppGroup:
618608
background=BackgroundTask(search_both_stores, search_term),
619609
)
620610

621-
@get(path="/search/{search_term:str}/playstore", cache=3600)
622-
async def search_playstore(self: Self, search_term: str) -> AppGroup:
623-
"""Search apps and developers.
624-
625-
Args:
626-
----
627-
search_term: str the search term to search for.
628-
Can search packages, developers and app names.
629-
630-
"""
631-
start = time.perf_counter() * 1000
632-
results = google.search_play_store(search_term)
633-
app_group = AppGroup(title="Google Playstore Results", apps=results)
634-
duration = round((time.perf_counter() * 1000 - start), 2)
635-
logger.info(f"{self.path}/{search_term}/playstore took {duration}ms")
636-
if len(results) > 0:
637-
return Response(
638-
app_group,
639-
background=BackgroundTask(process_search_results, results),
640-
)
641-
return app_group
642-
643-
@get(path="/search/{search_term:str}/applestore", cache=3600)
644-
async def search_applestore(self: Self, search_term: str) -> AppGroup:
645-
"""Search apps and developers.
646-
647-
Args:
648-
----
649-
search_term: str the search term to search for.
650-
Can search packages, developers and app names.
651-
652-
"""
653-
logger.info(f"{self.path} term={search_term} for apple store")
654-
655-
start = time.perf_counter() * 1000
656-
657-
ids = apple.search_app_store_for_ids(search_term)
658-
full_results = [{"store_id": store_id, "store": 2} for store_id in ids]
659-
results = apple.app_details_for_ids(ids[:10])
660-
661-
df = pd.DataFrame(results)
662-
df = apple.clean_ios_app_df(df)
663-
664-
df["store_link"] = "https://apps.apple.com/us/app/-/id" + df["store_id"]
665-
666-
results_dict = df.to_dict(orient="records")
667-
668-
app_group = AppGroup(title="Apple App Store Results", apps=results_dict)
669-
duration = round((time.perf_counter() * 1000 - start), 2)
670-
logger.info(f"{self.path} took {duration}ms")
671-
if len(results) > 0:
672-
return Response(
673-
app_group,
674-
background=BackgroundTask(process_search_results, full_results),
675-
)
676-
return app_group
677-
678611
@post(path="/{store_id:str}/requestSDKScan")
679612
async def request_sdk_scan(self: Self, store_id: str) -> Response:
680613
"""Request a new SDK scan for an app."""

frontend/src/routes/search/[term]/+page.svelte

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { page } from '$app/state';
33
import type { SearchResponse } from '../../../types';
44
import AppGroupCard from '$lib/AppGroupCard.svelte';
5-
import { goto } from '$app/navigation';
65
76
import CompaniesOverviewTable from '$lib/CompaniesOverviewTable.svelte';
87
@@ -12,21 +11,6 @@
1211
1312
let { data }: Props = $props();
1413
let searchTerm: string | null = $state(page.params.term || '');
15-
16-
function searchGooglePlay() {
17-
if (searchTerm) {
18-
goto(`/search/${encodeURIComponent(searchTerm)}/playstore`);
19-
} else {
20-
console.log('search term error');
21-
}
22-
}
23-
function searchAppleStore() {
24-
if (searchTerm) {
25-
goto(`/search/${encodeURIComponent(searchTerm)}/applestore`);
26-
} else {
27-
console.log('search term error');
28-
}
29-
}
3014
</script>
3115

3216
<h1 class="h1">Search Results for {searchTerm}</h1>
@@ -62,27 +46,23 @@
6246
{#if typeof results != 'string'}
6347
{#if results.apps.length > 0}
6448
<AppGroupCard apps={results} />
49+
50+
<div class="card p-4 mt-4">
51+
<h3 class="h3">Didn't see what you're looking for?</h3>
52+
<p class="p-2">
53+
This search will also crawl the top 200 apps on Google Play and App Store and update
54+
AppGoblin over the next day. You can also reach out on Discord or GitHub if you have
55+
questions or need any support.
56+
</p>
57+
</div>
6558
{:else}
6659
<h2 class="h2 p-4">Apps</h2>
67-
<h3 class="h3">No apps found, please try your search again.</h3>
60+
<h3 class="h3">
61+
No apps found, but a search for {searchTerm} has been queued and full data from app store,
62+
if it exists, should be available in the coming days. Please feel free to reach out on GitHub
63+
or Discord if you have any questions.
64+
</h3>
6865
{/if}
69-
<div class="card p-4 mt-4">
70-
<h3 class="h3">Didn't see what you're looking for?</h3>
71-
<p class="p-2">
72-
Try searching on Google Play. Results will take an hour to be live on AppGoblin. If you
73-
still don't see what you're looking for please reach out on GitHub or Discord.
74-
</p>
75-
<card class="card preset-tonal p-4">
76-
<button class="btn preset-filled-primary p-2" onclick={searchGooglePlay}>
77-
Search Google Play Store
78-
</button>
79-
</card>
80-
<card class="card preset-tonal p-4">
81-
<button class="btn preset-filled-primary p-2" onclick={searchAppleStore}>
82-
Search Apple App Store
83-
</button>
84-
</card>
85-
</div>
8666
{:else}
8767
<p>Search failed please try again ... {results}</p>
8868
{/if}

frontend/src/routes/search/[term]/applestore/+page.server.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

frontend/src/routes/search/[term]/applestore/+page.svelte

Lines changed: 0 additions & 28 deletions
This file was deleted.

frontend/src/routes/search/[term]/playstore/+page.server.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

frontend/src/routes/search/[term]/playstore/+page.svelte

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)