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
import requests | |
from bs4 import BeautifulSoup | |
import csv | |
BASE_URL = "https://en.wikipedia.org" | |
SEARCH_URL = "https://en.wikipedia.org/wiki/Special:Search?search=insects&fulltext=Search&ns0=1" | |
def get_wikipedia_links(search_url): | |
r = requests.get(search_url) | |
soup = BeautifulSoup(r.content, 'html.parser') |
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
// Add the function to main menu | |
function onOpen() { | |
var ui = SpreadsheetApp.getUi(); | |
ui.createMenu('🎉') | |
.addItem("Create Comparisons", "productComparison") | |
.addToUi(); | |
} | |
// Function to create comparisons | |
function productComparison() { |
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
function getTitleOrH1(url) { | |
var response = UrlFetchApp.fetch(url, | |
{ | |
method: "get", | |
muteHttpExceptions: true | |
}); | |
var html = response.getContentText(); | |
var titleMatch = html.match("<title>(.*?)</title>"); | |
var h1Match = html.match("<h1[^>]*>(.*?)</h1>"); | |
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
function transcribeAudio() { | |
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); | |
var numRows = sheet.getLastRow(); | |
var urlColumn = 1; // Column A | |
var transcriptColumn = 2; // Column B | |
var authToken = "YOUR_OPENAI_API"; // Your OpenAI API Token | |
var model = "whisper-1"; // The Whisper API Model to use | |
for (var i = 2; i <= numRows; i++) { | |
var url = sheet.getRange(i, urlColumn).getValue(); |