Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History

README.md

Outline

Rektify AI Web Scraper

The web scraper is used to extract data from webpages using Python's BeautifulSoup and natural language processing. We wish to use DeFi exploit specific APIs to autonmously funnel data into REAL, but the DeFi industry is still relatively new.

To expand the data-driven functionality of Rektify AI we are building our own API with all the DeFi attack data we've curated, aggregated, and wrangled to be the one-stop shop for the DeFi ecosystem. In the meanwhile, Python's BeautifulSoup allows us to extract qualitative and quantative attack data from HTML/XML text inside of webpages.

The following websites are used in Rektify web scraper:

Get requests through APIs

The preceding are a few APIs Sena will be using to curate protocol specific data. DeFi Llama's API is a source to retrieve total value locked at the time of the exploit, a registery of DeFi protocols, and on-chain data. DeFi Pulse's API gives access to ETH gas prices as well as an on-slot of data providers for future needs. Twitter's API allows us to monitor protocol activity. All data curated from these APIs will be curated under columns in the SEAL dataset.


Insights into Web Scraping using Python BeautifulSoup & Autoscraper

Each data vector needed to be cleaned: protocol names, dates, and amount lost in attack. The most intricate vector that needed prime attention were the dates. Dates and amounts with concatenated together with excessive spaces and a vertical bar(|).

Here's an example of how the data is formatted within the HTML text:

Input: '$55,000,000 | 11/05/2021'

The amount lost and dates are concatenated together which makes the task of curating each item difficult. But with BeautifulSoup the task is much easier.

Here's a few lines of code used to extract the dates from the unstructured html text data:

clean_dates = [] # Empty list to store cleaned dates
for item in dates:
    i = item.lstrip(',000,000 | ') # Removes the leading characters
    
    clean_dates.append(i)

Trial and error was used to find the proper parameters for the .lstrip method used to remove leading chars in Strings.

Output: 11/05/2021

Redirect link: Follow the logic and results in the web scraper directory.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.