Write a Python program that implements a simple web scraper and REST API using Flask. The scraper should fetch data from a website (e.g., news articles), store it in a database, and the API should allow users to query the stored data.
To create a simple web scraper and REST API using Flask, you'll need to follow these steps:

1. Install the required libraries: `Flask`, `requests`, `BeautifulSoup4`, and `sqlite3`.
2. Create a Python script for your web scraper.
3. Create a Python script for your REST API with Flask.

Here's an example of how you can implement this:

First, install the required libraries:

```bash
pip install Flask requests BeautifulSoup4
```

Next, create a file called `scraper.py` containing the following code:

```python
import requests
from bs4 import BeautifulSoup
import sqlite3

def scrape_news_articles():
    url = "https://www.example.com/news"  # Replace with the URL of the website you want to scrape
    response = requests.get(url)
    soup = BeautifulSoup(response.text, 'html.parser')

    articles = []

    for article in soup.find_all('article'):  # Modify this line based on the HTML structure of the website
        title = article.find('h2').text.strip()
        link = article.find('a')['href']
        articles.append((title, link))

    return articles

def store_articles(articles):
    conn = sqlite3.connect('news.db')
    c = conn.cursor()

    c.execute('''CREATE TABLE IF NOT EXISTS news (title TEXT, link TEXT)''')

    for article in articles:
        c.execute("INSERT INTO news VALUES (?, ?)", article)

    conn.commit()
    conn.close()

if __name__ == "__main__":
    articles = scrape_news_articles()
    store_articles(articles)
```

Now, create another file called `api.py` containing the following code:

```python
from flask import Flask, jsonify
import sqlite3

app = Flask(__name__)

@app.route('/api/v1/news', methods=['GET'])
def get_news():
    conn = sqlite3.connect('news.db')
    conn.row_factory = sqlite3.Row
    c = conn.cursor()

    c.execute("SELECT * FROM news")
    rows = c.fetchall()
    news = [dict(row) for row in rows]

    return jsonify(news)

if __name__ == '__main__':
    app.run(debug=True)
```

First, run the `scraper.py` script to scrape and store the news articles:

```bash
python scraper.py
```

Then, start your Flask REST API by running the `api.py` script:

```bash
python api.py
```

Now you can access the stored news articles at `http://127.0.0.1:5000/api/v1/news`.

Please note that this is a simple example and may require modifications based on the website you want to scrape and the data you want to store. Make sure to follow the website's terms of service and robots.txt rules when scraping.