reafactor readme added instructions and texts
This commit is contained in:
parent
d60c376013
commit
1121b7940f
4 changed files with 47 additions and 47 deletions
|
|
@ -34,7 +34,7 @@ OpenShorts leverages state-of-the-art AI to handle the entire content lifecycle:
|
|||
|
||||
* **Docker & Docker Compose**.
|
||||
* **Google Gemini API Key** ([Get it for free here](https://aistudio.google.com/app/apikey)).
|
||||
* **Upload-Post API Key** (Optional, for direct social posting).
|
||||
* **Upload-Post API Key** (Optional, for direct social posting. **Free tier available, no credit card required**).
|
||||
|
||||
### 📲 Social Media Setup (Upload-Post)
|
||||
To enable direct posting, follow these steps:
|
||||
|
|
@ -44,7 +44,6 @@ To enable direct posting, follow these steps:
|
|||
4. **Get API Key**: Navigate to [API Keys](https://app.upload-post.com/api-keys) and generate your key.
|
||||
5. **Use in OpenShorts**: Paste the API Key and select your Profile in the dashboard.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { getApiUrl } from './config';
|
|||
|
||||
// Enhanced "Encryption" using XOR + Base64 with a Salt
|
||||
// This is better than plain Base64 but still client-side.
|
||||
const SECRET_KEY = import.meta.env.VITE_ENCRYPTION_KEY || "OpenShorts-Secret-Key-2025-V1";
|
||||
const SECRET_KEY = import.meta.env.VITE_ENCRYPTION_KEY || "OpenShorts-Static-Salt-Change-Me";
|
||||
const ENCRYPTION_PREFIX = "ENC:";
|
||||
|
||||
const encrypt = (text) => {
|
||||
|
|
@ -368,7 +368,15 @@ function App() {
|
|||
<KeyInput onKeySet={setApiKey} savedKey={apiKey} />
|
||||
|
||||
<div className="glass-panel p-6 mt-8">
|
||||
<h2 className="text-lg font-semibold mb-4">Social Integration</h2>
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<h2 className="text-lg font-semibold">Social Integration</h2>
|
||||
<span className="text-[10px] bg-white/5 border border-white/5 px-2 py-0.5 rounded text-zinc-500 uppercase tracking-wider">Optional</span>
|
||||
</div>
|
||||
<p className="text-xs text-zinc-500 mb-6 leading-relaxed">
|
||||
Automatically publish your clips to TikTok, Instagram Reels, and YouTube Shorts via <strong>Upload-Post</strong>.
|
||||
Includes a <strong>free tier</strong> (no credit card required).
|
||||
If you prefer, you can skip this and manually download/upload your videos.
|
||||
</p>
|
||||
<div className="space-y-4">
|
||||
<label className="block text-sm text-zinc-400">Upload-Post API Key</label>
|
||||
<div className="flex gap-2">
|
||||
|
|
@ -445,8 +453,8 @@ function App() {
|
|||
Live Analysis
|
||||
</h2>
|
||||
<span className={`text-xs px-2 py-1 rounded-full border ${status === 'processing' ? 'bg-primary/10 border-primary/20 text-primary' :
|
||||
status === 'complete' ? 'bg-green-500/10 border-green-500/20 text-green-400' :
|
||||
'bg-red-500/10 border-red-500/20 text-red-400'
|
||||
status === 'complete' ? 'bg-green-500/10 border-green-500/20 text-green-400' :
|
||||
'bg-red-500/10 border-red-500/20 text-red-400'
|
||||
}`}>
|
||||
{status.toUpperCase()}
|
||||
</span>
|
||||
|
|
@ -493,21 +501,21 @@ function App() {
|
|||
)}
|
||||
</h2>
|
||||
|
||||
<div className="flex-1 overflow-y-auto custom-scrollbar p-1">
|
||||
{results && results.clips && results.clips.length > 0 ? (
|
||||
<div className="grid grid-cols-1 xl:grid-cols-2 gap-4 pb-10">
|
||||
{results.clips.map((clip, i) => (
|
||||
<ResultCard
|
||||
key={i}
|
||||
clip={clip}
|
||||
index={i}
|
||||
jobId={jobId}
|
||||
uploadPostKey={uploadPostKey}
|
||||
uploadUserId={uploadUserId}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex-1 overflow-y-auto custom-scrollbar p-1">
|
||||
{results && results.clips && results.clips.length > 0 ? (
|
||||
<div className={`grid gap-4 pb-10 ${status === 'complete' ? 'grid-cols-1 xl:grid-cols-2' : 'grid-cols-1'}`}>
|
||||
{results.clips.map((clip, i) => (
|
||||
<ResultCard
|
||||
key={i}
|
||||
clip={clip}
|
||||
index={i}
|
||||
jobId={jobId}
|
||||
uploadPostKey={uploadPostKey}
|
||||
uploadUserId={uploadUserId}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
status === 'processing' ? (
|
||||
<div className="h-full flex flex-col items-center justify-center text-zinc-500 space-y-4 opacity-50">
|
||||
<div className="w-12 h-12 rounded-full border-2 border-zinc-800 border-t-primary animate-spin" />
|
||||
|
|
|
|||
|
|
@ -66,9 +66,9 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
|
|||
const videoUrl = getApiUrl(clip.video_url);
|
||||
|
||||
return (
|
||||
<div className="bg-surface border border-white/5 rounded-2xl overflow-hidden flex flex-col md:flex-row group hover:border-white/10 transition-all animate-[fadeIn_0.5s_ease-out] h-auto md:h-[350px]" style={{ animationDelay: `${index * 0.1}s` }}>
|
||||
{/* Left: Video Preview (Fixed Width on Desktop) */}
|
||||
<div className="w-full md:w-[200px] bg-black relative shrink-0 aspect-[9/16] md:aspect-auto">
|
||||
<div className="bg-surface border border-white/5 rounded-2xl overflow-hidden flex flex-col md:flex-row group hover:border-white/10 transition-all animate-[fadeIn_0.5s_ease-out] min-h-[300px] h-auto" style={{ animationDelay: `${index * 0.1}s` }}>
|
||||
{/* Left: Video Preview (Responsive Width) */}
|
||||
<div className="w-full md:w-[180px] lg:w-[200px] bg-black relative shrink-0 aspect-[9/16] md:aspect-auto">
|
||||
<video
|
||||
src={videoUrl}
|
||||
controls
|
||||
|
|
@ -84,15 +84,15 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
|
|||
</div>
|
||||
|
||||
{/* Right: Content & Details */}
|
||||
<div className="flex-1 p-5 flex flex-col bg-[#121214] overflow-hidden">
|
||||
<div className="flex-1 p-4 md:p-5 flex flex-col bg-[#121214] overflow-hidden min-w-0">
|
||||
<div className="mb-4">
|
||||
<h3 className="text-base font-bold text-white leading-tight line-clamp-2 mb-2" title={clip.video_title_for_youtube_short}>
|
||||
<h3 className="text-base font-bold text-white leading-tight line-clamp-2 mb-2 break-words" title={clip.video_title_for_youtube_short}>
|
||||
{clip.video_title_for_youtube_short || "Viral Clip Generated"}
|
||||
</h3>
|
||||
<div className="flex gap-2 text-[10px] text-zinc-500 font-mono">
|
||||
<span className="bg-white/5 px-1.5 py-0.5 rounded border border-white/5">{Math.floor(clip.end - clip.start)}s</span>
|
||||
<span className="bg-white/5 px-1.5 py-0.5 rounded border border-white/5">#shorts</span>
|
||||
<span className="bg-white/5 px-1.5 py-0.5 rounded border border-white/5">#viral</span>
|
||||
<div className="flex flex-wrap gap-2 text-[10px] text-zinc-500 font-mono">
|
||||
<span className="bg-white/5 px-1.5 py-0.5 rounded border border-white/5 shrink-0">{Math.floor(clip.end - clip.start)}s</span>
|
||||
<span className="bg-white/5 px-1.5 py-0.5 rounded border border-white/5 shrink-0">#shorts</span>
|
||||
<span className="bg-white/5 px-1.5 py-0.5 rounded border border-white/5 shrink-0">#viral</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -101,9 +101,9 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
|
|||
{/* YouTube */}
|
||||
<div className="bg-black/20 rounded-lg p-3 border border-white/5">
|
||||
<div className="flex items-center gap-2 text-[10px] font-bold text-red-400 mb-1.5 uppercase tracking-wider">
|
||||
<Youtube size={12} /> YouTube Title
|
||||
<Youtube size={12} className="shrink-0" /> <span className="truncate">YouTube Title</span>
|
||||
</div>
|
||||
<p className="text-xs text-zinc-300 select-all">
|
||||
<p className="text-xs text-zinc-300 select-all break-words">
|
||||
{clip.video_title_for_youtube_short || "Viral Short Video"}
|
||||
</p>
|
||||
</div>
|
||||
|
|
@ -111,12 +111,12 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
|
|||
{/* TikTok / IG */}
|
||||
<div className="bg-black/20 rounded-lg p-3 border border-white/5">
|
||||
<div className="flex items-center gap-2 text-[10px] font-bold text-zinc-400 mb-1.5 uppercase tracking-wider">
|
||||
<Video size={12} className="text-cyan-400" />
|
||||
<Video size={12} className="text-cyan-400 shrink-0" />
|
||||
<span className="text-zinc-500">/</span>
|
||||
<Instagram size={12} className="text-pink-400" />
|
||||
Caption
|
||||
<Instagram size={12} className="text-pink-400 shrink-0" />
|
||||
<span className="truncate">Caption</span>
|
||||
</div>
|
||||
<p className="text-xs text-zinc-300 line-clamp-3 hover:line-clamp-none transition-all cursor-pointer select-all">
|
||||
<p className="text-xs text-zinc-300 line-clamp-3 hover:line-clamp-none transition-all cursor-pointer select-all break-words">
|
||||
{clip.video_description_for_tiktok || clip.video_description_for_instagram}
|
||||
</p>
|
||||
</div>
|
||||
|
|
@ -126,16 +126,16 @@ export default function ResultCard({ clip, index, jobId, uploadPostKey, uploadUs
|
|||
<div className="grid grid-cols-2 gap-3 mt-auto pt-4 border-t border-white/5">
|
||||
<button
|
||||
onClick={() => setShowModal(true)}
|
||||
className="col-span-1 py-2 bg-primary hover:bg-blue-600 text-white rounded-lg text-xs font-bold shadow-lg shadow-primary/20 transition-all active:scale-[0.98] flex items-center justify-center gap-2"
|
||||
className="col-span-1 py-2 bg-primary hover:bg-blue-600 text-white rounded-lg text-xs font-bold shadow-lg shadow-primary/20 transition-all active:scale-[0.98] flex items-center justify-center gap-2 truncate px-2"
|
||||
>
|
||||
<Share2 size={14} /> Post
|
||||
<Share2 size={14} className="shrink-0" /> Post
|
||||
</button>
|
||||
<a
|
||||
href={videoUrl}
|
||||
download
|
||||
className="col-span-1 py-2 bg-white/5 hover:bg-white/10 text-zinc-300 hover:text-white rounded-lg text-xs font-medium transition-colors flex items-center justify-center gap-2 border border-white/5"
|
||||
className="col-span-1 py-2 bg-white/5 hover:bg-white/10 text-zinc-300 hover:text-white rounded-lg text-xs font-medium transition-colors flex items-center justify-center gap-2 border border-white/5 truncate px-2"
|
||||
>
|
||||
<Download size={14} /> Download
|
||||
<Download size={14} className="shrink-0" /> Download
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
7
main.py
7
main.py
|
|
@ -451,13 +451,6 @@ def get_viral_clips(transcript_result, video_duration):
|
|||
print("❌ Error: GEMINI_API_KEY not found in environment variables.")
|
||||
return None
|
||||
|
||||
# Debug: Print masked key to verify it's loaded correctly
|
||||
print(f"🔑 Loaded API Key: {api_key[:4]}...{api_key[-4:]} (Length: {len(api_key)})")
|
||||
|
||||
if not api_key.startswith("AIza"):
|
||||
print("\n⚠️ WARNING: The API Key does not start with 'AIza'. Google AI Studio keys typically start with 'AIza'.")
|
||||
print(" Please check that you copied the 'API Key' and not a Client ID, Secret, or Token.")
|
||||
print(" Get your key here: https://aistudio.google.com/app/apikey\n")
|
||||
|
||||
client = genai.Client(api_key=api_key)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue