mirror of
https://github.com/towfiqi/serpbear
synced 2025-06-26 18:15:54 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83c47452fc | ||
|
|
56ffbf59d1 | ||
|
|
9a7a43f051 | ||
|
|
724d3c8d43 | ||
|
|
7e8840c2e2 | ||
|
|
0e64b95cd5 |
16
CHANGELOG.md
16
CHANGELOG.md
@@ -2,6 +2,22 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [1.0.3](https://github.com/towfiqi/serpbear/compare/v1.0.2...v1.0.3) (2024-02-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Resolves App not reloading on Scraper setup. ([56ffbf5](https://github.com/towfiqi/serpbear/commit/56ffbf59d1e459a6c7229d141ccc6774dc8055d0))
|
||||
* Resolves large keywords breaking the keywords table ui ([724d3c8](https://github.com/towfiqi/serpbear/commit/724d3c8d4309c7bd4f40e9db980ad54f99023d35))
|
||||
* Resolves scraper not able to scrape some keywords correctly. ([9a7a43f](https://github.com/towfiqi/serpbear/commit/9a7a43f051387cacc13116c0a7c21716b54e539b))
|
||||
|
||||
### [1.0.2](https://github.com/towfiqi/serpbear/compare/v1.0.1...v1.0.2) (2024-02-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Resolves Incorrect Position issue. ([0e64b95](https://github.com/towfiqi/serpbear/commit/0e64b95cd5303525535ea84a77181281d7f5618e)), closes [#164](https://github.com/towfiqi/serpbear/issues/164)
|
||||
|
||||
### [1.0.1](https://github.com/towfiqi/serpbear/compare/v1.0.0...v1.0.1) (2024-02-13)
|
||||
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ const Keyword = (props: KeywordProps) => {
|
||||
<Icon type="check" size={10} />
|
||||
</button>
|
||||
<a
|
||||
className='py-2 hover:text-blue-600 lg:flex lg:items-center lg:w-full'
|
||||
className='py-2 hover:text-blue-600 lg:flex lg:items-center lg:w-full lg:max-w-[200px]'
|
||||
onClick={() => showKeywordDetails()}>
|
||||
<span className={`fflag fflag-${country} w-[18px] h-[12px] mr-2`} title={countries[country][0]} />
|
||||
<span className=' text-ellipsis overflow-hidden whitespace-nowrap w-[calc(100%-30px)]'>{keyword}{city ? ` (${city})` : ''}</span>
|
||||
|
||||
@@ -82,6 +82,10 @@ const Settings = ({ closeSettings }:SettingsProps) => {
|
||||
} else {
|
||||
// Perform Update
|
||||
updateMutate(settings);
|
||||
// If Scraper is updated, refresh the page.
|
||||
if (appSettings.settings === 'none' && scraper_type !== 'none') {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "serpbear",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.3",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "serpbear",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.3",
|
||||
"dependencies": {
|
||||
"@googleapis/searchconsole": "^1.0.0",
|
||||
"@types/react-transition-group": "^4.4.5",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "serpbear",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.3",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -149,14 +149,13 @@ export const extractScrapedResult = (content: string, device: string): SearchRes
|
||||
|
||||
const $ = cheerio.load(content);
|
||||
const hasNumberofResult = $('body').find('#search > div > div');
|
||||
const searchResult = hasNumberofResult.children();
|
||||
const searchResultItems = hasNumberofResult.find('h3');
|
||||
let lastPosition = 0;
|
||||
|
||||
for (let i = 0; i < searchResult.length; i += 1) {
|
||||
if (searchResult[i]) {
|
||||
const title = $(searchResult[i]).find('h3').html();
|
||||
const url = $(searchResult[i]).find('a').attr('href');
|
||||
// console.log(i, url?.slice(0, 40), title?.slice(0, 40));
|
||||
for (let i = 0; i < searchResultItems.length; i += 1) {
|
||||
if (searchResultItems[i]) {
|
||||
const title = $(searchResultItems[i]).html();
|
||||
const url = $(searchResultItems[i]).closest('a').attr('href');
|
||||
if (title && url) {
|
||||
lastPosition += 1;
|
||||
extractedResult.push({ title, url, position: lastPosition });
|
||||
@@ -195,9 +194,13 @@ export const getSerp = (domainURL:string, result:SearchResult[]) : SERPObject =>
|
||||
if (result.length === 0 || !domainURL) { return { postion: 0, url: '' }; }
|
||||
const URLToFind = new URL(domainURL.includes('https://') ? domainURL : `https://${domainURL}`);
|
||||
const theURL = URLToFind.hostname + URLToFind.pathname;
|
||||
const isURL = URLToFind.pathname !== '/';
|
||||
const foundItem = result.find((item) => {
|
||||
const itemURL = new URL(item.url.includes('https://') ? item.url : `https://${item.url}`);
|
||||
return theURL === itemURL.hostname + itemURL.pathname || `${theURL}/` === itemURL.hostname + itemURL.pathname;
|
||||
if (isURL && `${theURL}/` === itemURL.hostname + itemURL.pathname) {
|
||||
return true;
|
||||
}
|
||||
return URLToFind.hostname === itemURL.hostname;
|
||||
});
|
||||
return { postion: foundItem ? foundItem.position : 0, url: foundItem && foundItem.url ? foundItem.url : '' };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user