-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bbdb4b4
commit 21d6f64
Showing
8 changed files
with
116 additions
and
55 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,11 @@ | ||
from newsScraper import scrape_cnbctech, is_today, scrape_verge, scrape_techcrunch | ||
from datetime import datetime | ||
import openai | ||
import requests | ||
from bs4 import BeautifulSoup | ||
import re | ||
import datetime | ||
from utils.utils import get_day_of_week, get_next_weekday, get_upload_date, spanish_title_case, english_title_case | ||
import base64 | ||
|
||
today = datetime.date.today() | ||
from openai import OpenAI | ||
from dotenv import load_dotenv | ||
import os | ||
from utils.utils import spanish_title_case, english_title_case | ||
|
||
|
||
def test_scrape_cnbctech(): | ||
url = 'https://techcrunch.com/' | ||
response = requests.get(url) | ||
soup = BeautifulSoup(response.text, 'html.parser') | ||
data_links = soup.find_all('a', attrs={'data-destinationlink': True}) | ||
|
||
# Debugging: print the number of data_links found | ||
print(f"Number of data links found: {len(data_links)}") | ||
|
||
# Extract the href attributes and text of these links | ||
articles = [[link.text.strip(), link['href']] for link in data_links if is_today(link['href'], current_dat) and len(link.text.strip()) > 0] | ||
print(articles) | ||
return articles | ||
|
||
|
||
print(get_upload_date('2024-05-21')) | ||
print(english_title_case("🔜 Nvidia’s new annual ai chip rollout 🧠, Amazon alexa’s ai overhaul with subscription 🎙️, microsoft ties executive pay to cybersecurity 💼")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters