MCPcopy Index your code
hub / github.com/USCDataScience/sparkler

github.com/USCDataScience/sparkler @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
536 symbols 1,374 edges 115 files 161 documented · 30%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Sparkler

Slack

Open in Gitpod

A web crawler is a bot program that fetches resources from the web for the sake of building applications like search engines, knowledge bases, etc. Sparkler (contraction of Spark-Crawler) is a new web crawler that makes use of recent advancements in distributed computing and information retrieval domains by conglomerating various Apache projects like Spark, Kafka, Lucene/Solr, Tika, and pf4j. Sparkler is an extensible, highly scalable, and high-performance web crawler that is an evolution of Apache Nutch and runs on Apache Spark Cluster.

NOTE:

~~Sparkler is being proposed to Apache Incubator. Review the proposal document and provide your suggestions here here~~ Will be done later, eventually!

Notable features of Sparkler:

  • Provides Higher performance and fault tolerance: The crawl pipeline has been redesigned to take advantage of the caching and fault tolerance capability of Apache Spark.
  • Supports complex and near real-time analytics: The internal data-structure is an indexed store powered by Apache Lucene and has the functionality to answer complex queries in near real time. Apache Solr (Supporting standalone for a quick start and cloud mode to scale horizontally) is used to expose the crawler analytics via HTTP API. These analytics can be visualized using intuitive charts in Admin dashboard (coming soon).
  • Streams out the content in real-time: Optionally, Apache Kafka can be configured to retrieve the output content as and when the content becomes available.
  • Java Script Rendering Executes the javascript code in webpages to create final state of the page. The setup is easy and painless, scales by distributing the work on Spark. It preserves the sessions and cookies for the subsequent requests made to a host.
  • Extensible plugin framework: Sparkler is designed to be modular. It supports plugins to extend and customize the runtime behaviour.
  • Universal Parser: Apache Tika, the most popular content detection, and content analysis toolkit that can deal with thousands of file formats, is used to discover links to the outgoing web resources and also to perform analysis on fetched resources.

Quick Start: Running your first crawl job in minutes

To use sparkler, install docker and run the below commands:

# Step 0. Get the image
docker pull ghcr.io/uscdatascience/sparkler/sparkler:main
# Step 1. Create a volume for elastic
docker volume create elastic
# Step 1. Inject seed urls
docker run -v elastic:/elasticsearch-7.17.0/data ghcr.io/uscdatascience/sparkler/sparkler:main inject -id myid -su 'http://www.bbc.com/news'
# Step 3. Start the crawl job
docker run -v elastic:/elasticsearch-7.17.0/data ghcr.io/uscdatascience/sparkler/sparkler:main crawl -id myid -tn 100 -i 2     # id=1, top 100 URLs, do -i=2 iterations

Running Sparkler with seed urls file:

1. Follow Steps 0-1
2. Create a file name seed-urls.txt using Emacs editor as follows:     
       a. emacs sparkler/bin/seed-urls.txt 
       b. copy paste your urls 
       c. Ctrl+x Ctrl+s to save  
       d. Ctrl+x Ctrl+c to quit the editor [Reference: http://mally.stanford.edu/~sr/computing/emacs.html]

* Note: You can use Vim and Nano editors also or use: echo -e "http://example1.com\nhttp://example2.com" >> seedfile.txt command.

3. Inject seed urls using the following command, (assuming you are in sparkler/bin directory) 
$bash sparkler.sh inject -id 1 -sf seed-urls.txt
4. Start the crawl job.

To crawl until the end of all new URLS, use -i -1, Example: /data/sparkler/bin/sparkler.sh crawl -id 1 -i -1

Making Contributions:

Contact Us

Any questions or suggestions are welcomed in our mailing list irds-l@mymaillists.usc.edu Alternatively, you may use the slack channel for getting help http://irds.usc.edu/sparkler/#slack

Extension points exported contracts — how you extend this code

ExtensionPoint (Interface)
The marker interface for all extensions @since Sparkler 0.1 [8 implementers]
sparkler-api/src/main/java/edu/usc/irds/sparkler/ExtensionPoint.java
Fetcher (Interface)
This class defines contact for Fetcher plugins. A fetcher takes a stream of uri to resources and fetches returns a lazy [6 …
sparkler-api/src/main/java/edu/usc/irds/sparkler/Fetcher.java
URLFilter (Interface)
A contract for any ExtensionPoint that offers functionality to filter urls @since Sparkler 0.1 [5 implementers]
sparkler-api/src/main/java/edu/usc/irds/sparkler/URLFilter.java
Scorer (Interface)
A contract for any ExtensionPoint that offers functionality to determine a score for urls. [2 implementers]
sparkler-api/src/main/java/edu/usc/irds/sparkler/Scorer.java
JobContext (Interface)
The contract for job Context @since Sparkler 0.1 [1 implementers]
sparkler-api/src/main/java/edu/usc/irds/sparkler/JobContext.java

Core symbols most depended-on inside this repo

get
called by 100
sparkler-api/src/main/java/edu/usc/irds/sparkler/util/DomainSuffixes.java
toString
called by 71
sparkler-api/src/main/java/edu/usc/irds/sparkler/model/Resource.java
getUrl
called by 20
sparkler-api/src/main/java/edu/usc/irds/sparkler/model/Resource.java
add
called by 16
sparkler-plugins/template-plugin/src/main/java/edu/usc/irds/sparkler/plugin/MyPlugin.java
size
called by 15
sparkler-api/src/main/java/edu/usc/irds/sparkler/ExtensionChain.java
getHost
called by 15
sparkler-api/src/main/java/edu/usc/irds/sparkler/util/URLUtil.java
setStatus
called by 14
sparkler-api/src/main/java/edu/usc/irds/sparkler/model/Resource.java
get
called by 14
retired/sparkler-sce/webui/app/apis/ns_search.py

Shape

Method 288
Function 115
Class 95
Route 18
Interface 15
Enum 5

Languages

Java63%
TypeScript22%
Python15%

Modules by API surface

sparkler-api/src/main/java/edu/usc/irds/sparkler/model/Resource.java40 symbols
retired/sparkler-sce/webui/app/controller.py36 symbols
sparkler-api/src/main/java/edu/usc/irds/sparkler/model/FetchedData.java24 symbols
retired/sparkler-ui/src/actions/index.js20 symbols
sparkler-api/src/main/java/edu/usc/irds/sparkler/util/URLUtil.java16 symbols
sparkler-plugins/fetcher-chrome/src/main/java/edu/usc/irds/sparkler/plugin/FetcherChrome.java15 symbols
sparkler-api/src/main/java/edu/usc/irds/sparkler/util/DomainSuffixesReader.java12 symbols
sparkler-tests-base/src/main/java/edu/usc/irds/sparkler/test/TestSlaveServlet.java10 symbols
sparkler-api/src/main/java/edu/usc/irds/sparkler/util/FetcherDefault.java10 symbols
sparkler-plugins/urlfilter-regex/src/main/java/edu/usc/irds/sparkler/plugin/regex/RegexURLFilterBase.java9 symbols
sparkler-api/src/main/java/edu/usc/irds/sparkler/SparklerConfiguration.java9 symbols
retired/sparkler-ui/src/components/dialogs/StartCrawlDialog.js9 symbols

For agents

$ claude mcp add sparkler \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact