Coder Social home page Coder Social logo

threeal / google-rank Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 1.0 36.24 MB

Retrieve the Google search ranking of your website for specific keywords

Home Page: https://www.npmjs.com/package/google-rank

License: MIT License

JavaScript 10.09% TypeScript 89.91%
cli google google-search search-ranking seo seotools tools

google-rank's Introduction

Google Rank

Google Rank is a tool designed to provide valuable insights into website visibility on Google search results. By tracking and monitoring your website's ranking for specific keywords, you can optimize your online presence and effectively reach a wider audience.

Whether you're an SEO specialist, a digital marketer, or a website owner, Google Rank empowers you to enhance your website's performance in search engine rankings. With this tool, you can stay informed about your website's visibility, make data-driven decisions, and improve your overall online presence.

Installation

To install the google-rank tool globally, run the following command:

$ npm install --global google-rank

Usage

To retrieve the rank of a website for a specific keyword, run the google-rank tool followed by the website URL and the search keyword:

$ google-rank wikipedia.org --keywords krakatoa

Ranks for wikipedia.org website:
page 1  rank 1  krakatoa

Multiple keywords can also be specified:

$ google-rank wikipedia.org --keywords krakatoa facebook 'social media'

Ranks for wikipedia.org website:
page 1  rank 1  krakatoa
page 2  rank 2  facebook
page 1  rank 1  social media

If the website is not found for the specified keywords, it will output the rank as ?:

$ google-rank wikipedia.org --keywords 'best city to travel'

Ranks for wikipedia.org website:
page ?  rank ?  best city to travel

License

This project is licensed under the terms of the MIT License.

Copyright © 2023-2024 Alfi Maulana

google-rank's People

Contributors

dependabot[bot] avatar threeal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

rigotamas

google-rank's Issues

Use Mocha Instead of Jest

This issue proposes the adoption of Mocha as the testing framework in this project, replacing Jest. To support Mocha as the testing framework, we can implement Chai as the assertion library and c8 for coverage checks. By switching to Mocha, we aim to leverage its flexibility and rich ecosystem of plugins for testing and reporting. Mocha, along with Chai and c8, will provide a comprehensive testing and coverage solution for the project. Let's consider this update to improve our testing capabilities.

429 error: Too many requests.

Just downloaded this npm and tested it 3 times. Got already a 429 error and can't resolve CAPTCHA.
'This page appears when Google automatically detects requests coming from your computer network which appear to be in violation of the <a href="//www.google.com/policies/terms/">Terms of Service</a>. The block will expire shortly after those requests stop.'

Mock Google Search Request for Testing

This pull request suggests implementing the mocking of Google Search requests to ensure consistent and successful test runs instead of relying on actual requests to Google.

Use TypeDoc for Documentation Generation

This issue proposes the adoption of TypeDoc to generate documentation from the comments present in the TypeScript source files. TypeDoc will allow us to automatically create comprehensive and well-structured documentation based on the inline comments within the codebase. By using TypeDoc, we can streamline the process of documenting our TypeScript project, making it easier for developers to understand the code and its API.

Make Keywords Arguments Optional

This issue aims to enhance the flexibility of the google-rank tool by making the keywords argument optional. The proposed modification addresses the current limitation where the tool requires the keywords argument even when the keywords themselves are provided in a separate file.

To address this issue, the following modifications are proposed:

  • When calling the tool without specifying any keywords, it will automatically search using the website URL itself as the keyword.
  • Keywords can be optionally specified using the --keywords parameter, supporting multiple keywords.

By making the keywords argument optional and introducing the --keywords parameter, users will have the flexibility to either provide keywords directly or use the website URL as the keyword when none are specified. This change allows for a more user-friendly and versatile experience when utilizing the google-rank tool.

Separate Workflows for Build and Test

This issue suggests implementing separate workflows for building and testing to align with the workflow structure of the Node.js Starter template. The goal is to enhance the organization and clarity of the project's CI/CD processes.

Use sort-package-json

This issue proposes the implementation of sort-package-json to automatically sort the contents of the package.json file. By incorporating sort-package-json, we can ensure a consistently organized package.json, which enhances readability and simplifies maintenance. Sorting the contents of package.json provides a standardized order for dependencies, scripts, and other properties, making it easier for contributors to find and manage project information.

Use Nx

This issue proposes adopting Nx to streamline the project's development workflow. By leveraging Nx's capabilities, we can automate the building process with a single command, benefiting from task caching to improve build times and overall efficiency.

Implement File Output Option

This issue suggests the implementation of an option that allows users to choose whether to output the ranking result directly to the terminal or save it to a file.

Remove Nx from Project Dependencies

This issue recommends the removal of Nx from the project. To address the command dependencies previously managed by Nx, the following changes are proposed:

  • Eliminate the build command and utilize the prepare script for compiling TypeScript source files into JavaScript distribution files.
  • Consolidate the format, lint, and sort commands into a unified check command.

Limit Requests to Prevent 429 from Google

This issue addresses the need to limit Google search requests to avoid encountering HTTP 429 errors. The following changes will be implemented to achieve this:

  • Modify the code to make requests sequentially, ensuring that one request is made after another.
  • Introduce a random delay between requests to avoid overwhelming the Google search service.
  • Add a --rapid option that allows making requests in parallel without any delay between them.

These changes aim to prevent HTTP 429 errors, which occur when there are too many requests made to Google within a short period. By implementing these modifications, we can ensure a more reliable and sustainable interaction with the Google search service, mitigating the risk of encountering rate-limiting issues.

Set `NODE_OPTIONS` for Running `test` Command

This issue suggests setting the NODE_OPTIONS environment variable with --experimental-vm-modules before executing the jest command in the test script. The proposed change aims to ensure that the test script can run successfully without requiring users to manually specify the NODE_OPTIONS environment variable. Currently, the test script will fail if the NODE_OPTIONS environment variable is not set with --experimental-vm-modules, potentially leading users to believe that the test is failing.

To address this, it is recommended to set the environment variable before invoking the jest command. This can be achieved using cross-env to set an environment variable in the package script before executing a command.

Keywords File Input

This issue proposes adding support for searching keywords using a file that contains a list of keywords.

The suggested solution involves implementing functionality that allows the google-rank tool to accept a file as input, which will contain a list of keywords to search for. This enhancement will provide users with the convenience of specifying a file instead of manually entering each keyword individually.

By supporting keywords file input, users can easily manage and update their keyword lists, making it more efficient to analyze website rankings across different keyword sets.

Adopt ECMAScript Modules

This issue suggests transitioning from CommonJS to ECMAScript as the primary module resolution method for this project. The proposed changes involve explicitly specifying type: module in the package.json and using .mjs or .mts file extensions instead of .js or .ts for the source files. This transition will enhance the project's compatibility with modern JavaScript standards and improve module resolution efficiency.

Remove Distribution Files

This issue suggests removing distribution files from the repository, allowing only source files in this repository.

Only Lint Source Files

This issue suggests modifying the lint script to only lint the source files in the src directory instead of linting all files in the root directory. Refer to threeal/nodejs-starter#356 for more information and the rationale behind this proposal.

Unuse @actions-kit/dev

This issue proposes to remove @actions-kit/dev from the dependencies and directly configure TypeScript, Prettier, ESLint, and Jest from within this project. This will make the project's build and development process more streamlined and less reliant on external packages.

Colored Terminal Output

This issue aims to enhance the terminal output by adding color to emphasize specific text. The proposed solution involves incorporating the chalk package, which provides a convenient way to apply colors and styles to the output.

Use Yarn

This issue suggests adopting Yarn as the default package manager, replacing the existing npm. Yarn offers several advantages over npm, including support for zero installation and parallel installation. By using Yarn, we can potentially improve the project's dependency resolution and installation speed, leading to a more efficient development experience.

Revert to Using Jest for Testing

This pull request proposes reverting back to using Jest for testing. The decision is based on the observation that using Mocha has introduced numerous dependencies and complexities. Additionally, this change may enable the reintroduction of TypeScript support in testing.

Consider Using an Alternative Google Search Library

This issue proposes exploring alternative Google Search libraries due to concerns about the current library, googlethis, which appears to be outdated and non-functional.

A potential alternative can be found in the npm registry by searching for "google search" here. One promising option is google-sr, which has recently been updated and is known to be working.

Remove Yarn Zero Install

This issue proposes the removal of Yarn's Zero-Install feature from the project. The rationale behind this proposal is that while using Yarn's Zero Install may seem convenient, it still necessitates calling yarn install, essentially resulting in an accumulation of unnecessary dependency files within the repository. By removing this feature, we aim to streamline the repository's structure and improve its efficiency.

Export Library Functions

This issue suggests exporting specific functions from the package to make them accessible for other projects. To achieve this, the proposal involves restructuring the project and separating the context for the library and the binary. The changes will include:

  • Creating a dist/index.js file as the primary entry point for the package.
  • Exporting most functions from dist/utils/google.js to dist/index.js.
  • Moving functions related to the dist/google-rank.js binary to a new dist/internal directory.

By making these modifications, the library's functions will be available for external usage, enabling other projects to benefit from the functionalities provided by this package.

Better Error Log

This issue aims to enhance the error handling and logging mechanism in the google-rank tool. The proposed solution suggests implementing error catching mechanisms to capture any potential errors that may occur during the execution of the tool. The objective is to improve the error logging by presenting error messages in a concise and visually appealing manner, ensuring better readability and understanding for users encountering errors.

Show Page Number

This issue requests the addition of functionality to display the Google search page number when ranking a website. Currently, the ranking information does not include the page number on which the website appears in the search results.

The proposed solution involves modifying the existing code to retrieve and display the corresponding page number alongside the website's rank. This enhancement will provide users with more detailed information about their website's position in the search results and help them better analyze their online visibility.

Remove Badges from Readme

This issue suggests removing badges from the README.md file because the information in the badges does not seem to be important to include in the readme. Refer to threeal/pipx-install-action#119 for more information and the rationale behind this proposal.

Fix Missing Shebang Line

This issue addresses the missing shebang line in the google-rank.ts source file, which prevents the binary file from being executed.

To resolve this issue, the following changes should be made to the google-rank.ts file:

+ #!/usr/bin/env node

// Existing code...

By adding the shebang line #!/usr/bin/env node at the beginning of the google-rank.ts file, it will ensure that the file can be executed as a binary.

Audit ts-jest Configuration for ESM Support

This issue suggests auditing the ts-jest configuration for ESM support in the jest.config.json and tsconfig.json files to follow this guide. The changes include adding some missing configurations in the tsconfig.json file and modifying some configurations in the jest.config.json file.

Remove Clean Command

This issue suggests removing the clean command, which was previously used to clean distribution files. Since the dist directory is no longer included in this project, the clean command no longer serves a meaningful purpose. Therefore, it's better to remove it.

Handle Invalid URLs

The searchWithPages function of the google-sr library, used in this project, occasionally returns search results that contain null links. These null links trigger invalid URL errors in our code. This issue proposes a solution to address this problem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.