diff --git a/.github/workflows/parent.yml b/.github/workflows/parent.yml new file mode 100644 index 0000000..48943b9 --- /dev/null +++ b/.github/workflows/parent.yml @@ -0,0 +1,58 @@ +name: Security Scan + +on: + push: + pull_request: + +jobs: + security-scan: + name: Security & Quality Check + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + + - name: Check Python syntax + run: | + python -m py_compile $(find . -name "*.py" -not -path "./.git/*") + + - name: Basic security checks + run: | + echo "Checking for potential issues..." + + # Check for hardcoded secrets + if grep -r -i -E "(password|secret|key|token)\s*=\s*['\"][^'\"]{8,}" --include="*.py" . ; then + echo "⚠️ Potential hardcoded secrets found!" + exit 1 + fi + + # Check for dangerous functions + if grep -r -E "(eval|exec)\s*\(" --include="*.py" . ; then + echo "⚠️ Dangerous functions found!" + exit 1 + fi + + echo "✅ Basic checks passed" + + - name: CodeQL Analysis + uses: github/codeql-action/init@v3 + with: + languages: python + + - name: Run CodeQL + uses: github/codeql-action/analyze@v3 \ No newline at end of file diff --git a/utils/download_yt.py b/utils/download_yt.py new file mode 100644 index 0000000..4a9cda7 --- /dev/null +++ b/utils/download_yt.py @@ -0,0 +1,54 @@ +import os +import sys +import yt_dlp +from pathlib import Path + +from yt_dlp import YoutubeDL + +class automateDownload: + def __init__(self): + pass + + def getUrlsInteractive(self): + urls = [] + + print("Youtube Video Downloader") + print("Enter Youtube URLs (press Enter on empty line to finish):") + + while True: + url = input(f"URL {len(urls) + 1}: ").strip() + if not url: + break + urls.append(url) + return urls + + def downloadVideos(self, urls): + ydl_opts = { + 'format': 'bestvideo[ext=mp4]/bestvideo', + 'merge_output_format': 'mp4', + 'outtmpl': 'downloads/%(title)s.%(ext)s', + 'ignoreerrors': True + } + + with yt_dlp.YoutubeDL(ydl_opts) as ydl: + for url in urls: + try: + print(f"Downloading: {url}") + ydl.download([url]) + print(f"Success: {url}") + except Exception as e: + print(f"Failed: {url} - {e}") + + def main(self): + urls = self.getUrlsInteractive() + + if not urls: + print("No URLS provided!") + sys.exit(1) + + print(f"\n Downloading {len(urls)} videos ...") + self.downloadVideos(urls) + +if __name__ == "__main__": + downloader = automateDownload() + downloader.main() \ No newline at end of file