{"id":24442143,"url":"https://github.com/techut30/multithreadwebcrawler","last_synced_at":"2025-03-14T02:27:35.358Z","repository":{"id":220798396,"uuid":"698931937","full_name":"techut30/MultiThreadWebCrawler","owner":"techut30","description":"This is a multi-threaded web crawler program coded in Java. Kindly change the webpages you want to crawl in the Main class of the program. ","archived":false,"fork":false,"pushed_at":"2024-09-16T21:53:04.000Z","size":415,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-20T21:47:20.496Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/techut30.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-01T12:29:24.000Z","updated_at":"2024-09-16T21:53:07.000Z","dependencies_parsed_at":"2024-02-04T12:53:37.527Z","dependency_job_id":"33358108-6dcd-4b5d-86e1-5a780feaf4e6","html_url":"https://github.com/techut30/MultiThreadWebCrawler","commit_stats":null,"previous_names":["techut30/multithreadwebcrawler"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techut30%2FMultiThreadWebCrawler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techut30%2FMultiThreadWebCrawler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techut30%2FMultiThreadWebCrawler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techut30%2FMultiThreadWebCrawler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/techut30","download_url":"https://codeload.github.com/techut30/MultiThreadWebCrawler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243510894,"owners_count":20302466,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-20T21:45:24.422Z","updated_at":"2025-03-14T02:27:35.349Z","avatar_url":"https://github.com/techut30.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Java WebCrawler\n\nThis is a multithreaded web crawler written in Java that uses the JSoup library to scrape websites. The program takes a URL as input and crawls through web pages up to a maximum depth of 5, printing out the title of each web page it visits. Multiple web crawlers run in parallel using threads to speed up the process.\n\n## Features\n\n- **Multithreaded**: Each web crawler runs on its own thread, allowing for parallel web scraping.\n- **Depth-limited crawling**: The crawler stops after reaching a specified depth of 5 to avoid infinite loops.\n- **Page Title Extraction**: The crawler prints the title of each web page it visits.\n- **Unique URL Visits**: The program ensures that no URL is visited more than once in a given session.\n\n## Project Structure\n\nThe project contains two main classes:\n\n1. **`WebCrawl`**: Implements the crawling logic. Each instance runs on its own thread and follows links up to a depth of 5.\n2. **`Main`**: The entry point of the program. It creates multiple web crawlers and manages their execution.\n\n## Installation\n\n### Prerequisites\n\n- Java Development Kit (JDK) version 8 or higher\n- Maven or Gradle (optional, for dependency management)\n- [JSoup Library](https://jsoup.org/), version 1.13.1 or higher\n\n### Steps\n\n1. **Clone the repository or copy the source code**:\n    ```bash\n    git clone https://github.com/yourusername/JavaWebCrawler.git\n    ```\n2. **Download JSoup**:\n    If using Maven, add the following dependency in your `pom.xml` file:\n    ```xml\n    \u003cdependency\u003e\n        \u003cgroupId\u003eorg.jsoup\u003c/groupId\u003e\n        \u003cartifactId\u003ejsoup\u003c/artifactId\u003e\n        \u003cversion\u003e1.13.1\u003c/version\u003e\n    \u003c/dependency\u003e\n    ```\n\n    If using Gradle, add this line to your `build.gradle`:\n    ```groovy\n    implementation 'org.jsoup:jsoup:1.13.1'\n    ```\n\n    Alternatively, download the JSoup JAR manually and add it to your project’s classpath.\n\n3. **Compile and run the program**:\n    ```bash\n    javac -cp jsoup-1.13.1.jar WebCrawler/*.java\n    java -cp .:jsoup-1.13.1.jar WebCrawler.Main\n    ```\n\n## How It Works\n\n### WebCrawl Class\n\n- **Constructor**: \n  - Takes the starting URL and a unique identifier for the crawler.\n  - Starts a new thread to run the crawling process.\n  \n- **crawl(int level, String url)**: \n  - Recursively crawls through the links found on the given URL until the maximum depth (5) is reached.\n  \n- **request(String url)**: \n  - Fetches the document from the given URL using JSoup.\n  - Prints the status code, title, and adds the URL to the visited list if the page was successfully fetched.\n\n### Main Class\n\n- **Main Method**:\n  - Initializes multiple web crawlers with different starting URLs.\n  - Manages the execution of each web crawler by calling `join()` to ensure the main thread waits for each crawler to finish before exiting.\n\n## Example\n\nIn the `Main` class, three instances of `WebCrawl` are created, each starting at different websites:\n- `https://www.wikipedia.org/`\n- `https://timesofindia.indiatimes.com/`\n- `https://www.cricbuzz.com/`\n\nEach crawler will explore up to a depth of 5 and print the titles of the web pages it visits.\n\n### Output Example:\n```text\nWebCrawler Created Successfully\nWebCrawler Created Successfully\nWebCrawler Created Successfully\n\nBot ID: 1 Recieved webpage link at : https://www.wikipedia.org/\nWikipedia\n\nBot ID: 1 Recieved webpage link at : https://www.wikibooks.org/\nWikibooks\n\nBot ID: 2 Recieved webpage link at : https://timesofindia.indiatimes.com/\nTimes of India\n\nBot ID: 3 Recieved webpage link at : https://www.cricbuzz.com/\nCricbuzz\n\n\n```\n\n## Customization\n\nTo customize the starting URLs or add more web crawlers:\n\n1. Open the `Main.java` file.\n2. Add more instances of `WebCrawl` with the desired URLs:\n    ```java\n    bot.add(new WebCrawl(\"https://example.com/\", 4));\n    ```\n\n## Limitations\n\n- The current implementation does not handle loops or duplicate links across different web crawlers.\n- The program may run into issues with sites that block web crawlers (like CAPTCHA or IP rate-limiting).\n- External links (URLs outside the base domain) are not filtered.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- [JSoup Library](https://jsoup.org/) for easy HTML parsing and web scraping in Java.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechut30%2Fmultithreadwebcrawler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechut30%2Fmultithreadwebcrawler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechut30%2Fmultithreadwebcrawler/lists"}