-
Notifications
You must be signed in to change notification settings - Fork 0
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
e2c7693
commit 8d26923
Showing
5 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
1. install pip | ||
2. install python library |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Load OnPage data into program | ||
|
||
import { NextResponse } from "next/server"; | ||
import fs from 'fs'; | ||
import { parse } from 'csv-parse/sync'; // A more robust CSV parsing | ||
import path from 'path'; | ||
|
||
export async function POST(request) { | ||
try { | ||
const data = await request.json(); | ||
const pages = data.pages; | ||
const dir = data.dir; | ||
|
||
// extract urls from pages | ||
for each page in pages | ||
get page url (maybe we use a map) | ||
get page h1 | ||
to create a new list of processedpages | ||
|
||
|
||
// transform pages into filenames | ||
// example: https.10xlivingctc.com > rendered_https_10xlivingctc.com_html | ||
|
||
// for everyfilename supply as argument to convert.py | ||
// convert.py will return .md files for each file originating from a page | ||
|
||
// for all .md files, open and scan for processedpages.h1 | ||
/2/ get the text from the markdown paragraph or line immediately following the h1 position | ||
// append that data to processedpages as page.onpage | ||
// return processed pages | ||
|
||
|
||
|
||
return NextResponse.json({ result }, { status: 200 }); | ||
} catch (error) { | ||
console.error('Failed to process files:', error); | ||
return NextResponse.json( { message: "ERROR" } , { status: 500 }); | ||
} | ||
} |
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