Tik Toks
This commit is contained in:
@@ -14,32 +14,25 @@ pipeline {
|
||||
|
||||
stages {
|
||||
|
||||
// ─────────────────────────────────────────────
|
||||
// 1. Checkout
|
||||
// ─────────────────────────────────────────────
|
||||
stage('Checkout Code') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────
|
||||
// 2. Python env + dependencies
|
||||
// ─────────────────────────────────────────────
|
||||
stage('Setup Python & Install Dependencies') {
|
||||
steps {
|
||||
sh '''
|
||||
set -e
|
||||
cd "$WORKSPACE"
|
||||
|
||||
# ── Create venv ────────────────────────────────────
|
||||
# Crea el venv
|
||||
python3 -m venv venv
|
||||
|
||||
# ── Upgrade pip toolchain ──────────────────────────
|
||||
. venv/bin/activate
|
||||
pip install --upgrade pip wheel setuptools
|
||||
# Usa sempre python3 -m pip, mai el binari pip directament
|
||||
"$WORKSPACE/venv/bin/python3" -m pip install --upgrade pip wheel setuptools
|
||||
|
||||
# ── Core dependencies ──────────────────────────────
|
||||
pip install -U \
|
||||
"$WORKSPACE/venv/bin/python3" -m pip install -U \
|
||||
atproto \
|
||||
playwright \
|
||||
playwright-stealth \
|
||||
@@ -50,91 +43,23 @@ pipeline {
|
||||
beautifulsoup4 \
|
||||
charset-normalizer \
|
||||
Pillow \
|
||||
grapheme
|
||||
grapheme \
|
||||
yt-dlp \
|
||||
curl-cffi
|
||||
|
||||
# ── yt-dlp: always upgrade to latest ──────────────
|
||||
# TikTok extractor breaks frequently — latest is required
|
||||
pip install --upgrade yt-dlp
|
||||
pip show yt-dlp | grep -E "^(Name|Version)"
|
||||
# Sanity checks
|
||||
"$WORKSPACE/venv/bin/python3" -c "import atproto; print('atproto OK')"
|
||||
"$WORKSPACE/venv/bin/python3" -c "import playwright; print('playwright OK')"
|
||||
"$WORKSPACE/venv/bin/python3" -c "import yt_dlp; print('yt_dlp OK')"
|
||||
"$WORKSPACE/venv/bin/python3" -c "import curl_cffi; print('curl_cffi OK')"
|
||||
|
||||
# ── curl_cffi: TikTok impersonation (REQUIRED) ─────
|
||||
# Without this yt-dlp cannot bypass TikTok bot detection
|
||||
pip install --upgrade curl-cffi
|
||||
pip show curl-cffi | grep -E "^(Name|Version)"
|
||||
python3 -c "import curl_cffi; print('curl_cffi OK')"
|
||||
|
||||
# ── playwright-stealth version check ───────────────
|
||||
pip show playwright-stealth | grep -E "^(Name|Version)"
|
||||
python3 -c "
|
||||
try:
|
||||
from playwright_stealth import stealth_sync
|
||||
print('playwright_stealth OK (v1.x - stealth_sync)')
|
||||
except ImportError:
|
||||
from playwright_stealth import Stealth
|
||||
print('playwright_stealth OK (v2.x - Stealth class)')
|
||||
"
|
||||
|
||||
# ── Sanity checks ──────────────────────────────────
|
||||
python3 -c "import atproto; print('atproto OK')"
|
||||
python3 -c "import playwright; print('playwright OK')"
|
||||
python3 -c "import yt_dlp; print('yt_dlp OK')"
|
||||
python3 -c "import httpx; print('httpx OK')"
|
||||
python3 -c "import arrow; print('arrow OK')"
|
||||
python3 -c "import moviepy; print('moviepy OK')"
|
||||
|
||||
# ── System tools ───────────────────────────────────
|
||||
ffmpeg -version | head -1
|
||||
ffprobe -version | head -1
|
||||
|
||||
# ── Playwright browser binaries ────────────────────
|
||||
playwright install chromium
|
||||
# Playwright browser binaries
|
||||
PLAYWRIGHT_BROWSERS_PATH=/var/jenkins_home/.playwright-browsers \
|
||||
"$WORKSPACE/venv/bin/python3" -m playwright install chromium
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────
|
||||
// 3. Run the bot
|
||||
// ─────────────────────────────────────────────
|
||||
stage('Run Script') {
|
||||
steps {
|
||||
withCredentials([
|
||||
string(
|
||||
credentialsId: 'TIKTOK_COMEDYGOLDBCN_HANDLE',
|
||||
variable: 'TIKTOK_COMEDYGOLDBCN_HANDLE'
|
||||
),
|
||||
string(
|
||||
credentialsId: 'BSKY_COMEDYGOLDBCN_HANDLE',
|
||||
variable: 'BSKY_COMEDYGOLDBCN_HANDLE'
|
||||
),
|
||||
string(
|
||||
credentialsId: 'BSKY_COMEDYGOLDBCN_APP_PASSWORD',
|
||||
variable: 'BSKY_COMEDYGOLDBCN_APP_PASSWORD'
|
||||
),
|
||||
file(
|
||||
credentialsId: 'TIKTOK_COOKIES_JSON',
|
||||
variable: 'TIKTOK_COOKIES_FILE'
|
||||
)
|
||||
]) {
|
||||
sh '''
|
||||
set -e
|
||||
|
||||
# Inject the secret cookies file into the workspace
|
||||
cp "$TIKTOK_COOKIES_FILE" tiktok_cookies.json
|
||||
|
||||
. venv/bin/activate
|
||||
python3 tiktok2bsky.py \
|
||||
--tiktok-handle "$TIKTOK_COMEDYGOLDBCN_HANDLE" \
|
||||
--bsky-handle "$BSKY_COMEDYGOLDBCN_HANDLE" \
|
||||
--bsky-app-password "$BSKY_COMEDYGOLDBCN_APP_PASSWORD" \
|
||||
--bsky-base-url https://bsky.social \
|
||||
--bsky-langs ca \
|
||||
--cookies-path tiktok_cookies.json
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────
|
||||
// Post actions
|
||||
// ─────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user