3Cat TikToks
This commit is contained in:
@@ -14,32 +14,25 @@ pipeline {
|
|||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
|
||||||
// ─────────────────────────────────────────────
|
|
||||||
// 1. Checkout
|
|
||||||
// ─────────────────────────────────────────────
|
|
||||||
stage('Checkout Code') {
|
stage('Checkout Code') {
|
||||||
steps {
|
steps {
|
||||||
checkout scm
|
checkout scm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─────────────────────────────────────────────
|
|
||||||
// 2. Python env + dependencies
|
|
||||||
// ─────────────────────────────────────────────
|
|
||||||
stage('Setup Python & Install Dependencies') {
|
stage('Setup Python & Install Dependencies') {
|
||||||
steps {
|
steps {
|
||||||
sh '''
|
sh '''
|
||||||
set -e
|
set -e
|
||||||
|
cd "$WORKSPACE"
|
||||||
|
|
||||||
# ── Create venv ────────────────────────────────────
|
# Crea el venv
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
|
|
||||||
# ── Upgrade pip toolchain ──────────────────────────
|
# Usa sempre python3 -m pip, mai el binari pip directament
|
||||||
. venv/bin/activate
|
"$WORKSPACE/venv/bin/python3" -m pip install --upgrade pip wheel setuptools
|
||||||
pip install --upgrade pip wheel setuptools
|
|
||||||
|
|
||||||
# ── Core dependencies ──────────────────────────────
|
"$WORKSPACE/venv/bin/python3" -m pip install -U \
|
||||||
pip install -U \
|
|
||||||
atproto \
|
atproto \
|
||||||
playwright \
|
playwright \
|
||||||
playwright-stealth \
|
playwright-stealth \
|
||||||
@@ -50,44 +43,19 @@ pipeline {
|
|||||||
beautifulsoup4 \
|
beautifulsoup4 \
|
||||||
charset-normalizer \
|
charset-normalizer \
|
||||||
Pillow \
|
Pillow \
|
||||||
grapheme
|
grapheme \
|
||||||
|
yt-dlp \
|
||||||
|
curl-cffi
|
||||||
|
|
||||||
# ── yt-dlp: always upgrade to latest ──────────────
|
# Sanity checks
|
||||||
# TikTok extractor breaks frequently — latest is required
|
"$WORKSPACE/venv/bin/python3" -c "import atproto; print('atproto OK')"
|
||||||
pip install --upgrade yt-dlp
|
"$WORKSPACE/venv/bin/python3" -c "import playwright; print('playwright OK')"
|
||||||
pip show yt-dlp | grep -E "^(Name|Version)"
|
"$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) ─────
|
# Playwright browser binaries
|
||||||
# Without this yt-dlp cannot bypass TikTok bot detection
|
PLAYWRIGHT_BROWSERS_PATH=/var/jenkins_home/.playwright-browsers \
|
||||||
pip install --upgrade curl-cffi
|
"$WORKSPACE/venv/bin/python3" -m playwright install chromium
|
||||||
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
|
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,32 +14,25 @@ pipeline {
|
|||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
|
||||||
// ─────────────────────────────────────────────
|
|
||||||
// 1. Checkout
|
|
||||||
// ─────────────────────────────────────────────
|
|
||||||
stage('Checkout Code') {
|
stage('Checkout Code') {
|
||||||
steps {
|
steps {
|
||||||
checkout scm
|
checkout scm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─────────────────────────────────────────────
|
|
||||||
// 2. Python env + dependencies
|
|
||||||
// ─────────────────────────────────────────────
|
|
||||||
stage('Setup Python & Install Dependencies') {
|
stage('Setup Python & Install Dependencies') {
|
||||||
steps {
|
steps {
|
||||||
sh '''
|
sh '''
|
||||||
set -e
|
set -e
|
||||||
|
cd "$WORKSPACE"
|
||||||
|
|
||||||
# ── Create venv ────────────────────────────────────
|
# Crea el venv
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
|
|
||||||
# ── Upgrade pip toolchain ──────────────────────────
|
# Usa sempre python3 -m pip, mai el binari pip directament
|
||||||
. venv/bin/activate
|
"$WORKSPACE/venv/bin/python3" -m pip install --upgrade pip wheel setuptools
|
||||||
pip install --upgrade pip wheel setuptools
|
|
||||||
|
|
||||||
# ── Core dependencies ──────────────────────────────
|
"$WORKSPACE/venv/bin/python3" -m pip install -U \
|
||||||
pip install -U \
|
|
||||||
atproto \
|
atproto \
|
||||||
playwright \
|
playwright \
|
||||||
playwright-stealth \
|
playwright-stealth \
|
||||||
@@ -50,91 +43,23 @@ pipeline {
|
|||||||
beautifulsoup4 \
|
beautifulsoup4 \
|
||||||
charset-normalizer \
|
charset-normalizer \
|
||||||
Pillow \
|
Pillow \
|
||||||
grapheme
|
grapheme \
|
||||||
|
yt-dlp \
|
||||||
|
curl-cffi
|
||||||
|
|
||||||
# ── yt-dlp: always upgrade to latest ──────────────
|
# Sanity checks
|
||||||
# TikTok extractor breaks frequently — latest is required
|
"$WORKSPACE/venv/bin/python3" -c "import atproto; print('atproto OK')"
|
||||||
pip install --upgrade yt-dlp
|
"$WORKSPACE/venv/bin/python3" -c "import playwright; print('playwright OK')"
|
||||||
pip show yt-dlp | grep -E "^(Name|Version)"
|
"$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) ─────
|
# Playwright browser binaries
|
||||||
# Without this yt-dlp cannot bypass TikTok bot detection
|
PLAYWRIGHT_BROWSERS_PATH=/var/jenkins_home/.playwright-browsers \
|
||||||
pip install --upgrade curl-cffi
|
"$WORKSPACE/venv/bin/python3" -m playwright install chromium
|
||||||
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
|
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─────────────────────────────────────────────
|
|
||||||
// 3. Run the bot
|
|
||||||
// ─────────────────────────────────────────────
|
|
||||||
stage('Run Script') {
|
|
||||||
steps {
|
|
||||||
withCredentials([
|
|
||||||
string(
|
|
||||||
credentialsId: 'TIKTOK_3CATCULTURA_HANDLE',
|
|
||||||
variable: 'TIKTOK_3CATCULTURA_HANDLE'
|
|
||||||
),
|
|
||||||
string(
|
|
||||||
credentialsId: 'BSKY_3CAT_HANDLE',
|
|
||||||
variable: 'BSKY_3CAT_HANDLE'
|
|
||||||
),
|
|
||||||
string(
|
|
||||||
credentialsId: 'BSKY_3CAT_APP_PASSWORD',
|
|
||||||
variable: 'BSKY_3CAT_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_3CATCULTURA_HANDLE" \
|
|
||||||
--bsky-handle "$BSKY_3CAT_HANDLE" \
|
|
||||||
--bsky-app-password "$BSKY_3CAT_APP_PASSWORD" \
|
|
||||||
--bsky-base-url https://eurosky.social \
|
|
||||||
--bsky-langs ca \
|
|
||||||
--cookies-path tiktok_cookies.json
|
|
||||||
'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─────────────────────────────────────────────
|
// ─────────────────────────────────────────────
|
||||||
// Post actions
|
// Post actions
|
||||||
// ─────────────────────────────────────────────
|
// ─────────────────────────────────────────────
|
||||||
|
|||||||
@@ -14,32 +14,25 @@ pipeline {
|
|||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
|
||||||
// ─────────────────────────────────────────────
|
|
||||||
// 1. Checkout
|
|
||||||
// ─────────────────────────────────────────────
|
|
||||||
stage('Checkout Code') {
|
stage('Checkout Code') {
|
||||||
steps {
|
steps {
|
||||||
checkout scm
|
checkout scm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─────────────────────────────────────────────
|
|
||||||
// 2. Python env + dependencies
|
|
||||||
// ─────────────────────────────────────────────
|
|
||||||
stage('Setup Python & Install Dependencies') {
|
stage('Setup Python & Install Dependencies') {
|
||||||
steps {
|
steps {
|
||||||
sh '''
|
sh '''
|
||||||
set -e
|
set -e
|
||||||
|
cd "$WORKSPACE"
|
||||||
|
|
||||||
# ── Create venv ────────────────────────────────────
|
# Crea el venv
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
|
|
||||||
# ── Upgrade pip toolchain ──────────────────────────
|
# Usa sempre python3 -m pip, mai el binari pip directament
|
||||||
. venv/bin/activate
|
"$WORKSPACE/venv/bin/python3" -m pip install --upgrade pip wheel setuptools
|
||||||
pip install --upgrade pip wheel setuptools
|
|
||||||
|
|
||||||
# ── Core dependencies ──────────────────────────────
|
"$WORKSPACE/venv/bin/python3" -m pip install -U \
|
||||||
pip install -U \
|
|
||||||
atproto \
|
atproto \
|
||||||
playwright \
|
playwright \
|
||||||
playwright-stealth \
|
playwright-stealth \
|
||||||
@@ -50,44 +43,19 @@ pipeline {
|
|||||||
beautifulsoup4 \
|
beautifulsoup4 \
|
||||||
charset-normalizer \
|
charset-normalizer \
|
||||||
Pillow \
|
Pillow \
|
||||||
grapheme
|
grapheme \
|
||||||
|
yt-dlp \
|
||||||
|
curl-cffi
|
||||||
|
|
||||||
# ── yt-dlp: always upgrade to latest ──────────────
|
# Sanity checks
|
||||||
# TikTok extractor breaks frequently — latest is required
|
"$WORKSPACE/venv/bin/python3" -c "import atproto; print('atproto OK')"
|
||||||
pip install --upgrade yt-dlp
|
"$WORKSPACE/venv/bin/python3" -c "import playwright; print('playwright OK')"
|
||||||
pip show yt-dlp | grep -E "^(Name|Version)"
|
"$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) ─────
|
# Playwright browser binaries
|
||||||
# Without this yt-dlp cannot bypass TikTok bot detection
|
PLAYWRIGHT_BROWSERS_PATH=/var/jenkins_home/.playwright-browsers \
|
||||||
pip install --upgrade curl-cffi
|
"$WORKSPACE/venv/bin/python3" -m playwright install chromium
|
||||||
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
|
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,32 +14,25 @@ pipeline {
|
|||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
|
||||||
// ─────────────────────────────────────────────
|
|
||||||
// 1. Checkout
|
|
||||||
// ─────────────────────────────────────────────
|
|
||||||
stage('Checkout Code') {
|
stage('Checkout Code') {
|
||||||
steps {
|
steps {
|
||||||
checkout scm
|
checkout scm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─────────────────────────────────────────────
|
|
||||||
// 2. Python env + dependencies
|
|
||||||
// ─────────────────────────────────────────────
|
|
||||||
stage('Setup Python & Install Dependencies') {
|
stage('Setup Python & Install Dependencies') {
|
||||||
steps {
|
steps {
|
||||||
sh '''
|
sh '''
|
||||||
set -e
|
set -e
|
||||||
|
cd "$WORKSPACE"
|
||||||
|
|
||||||
# ── Create venv ────────────────────────────────────
|
# Crea el venv
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
|
|
||||||
# ── Upgrade pip toolchain ──────────────────────────
|
# Usa sempre python3 -m pip, mai el binari pip directament
|
||||||
. venv/bin/activate
|
"$WORKSPACE/venv/bin/python3" -m pip install --upgrade pip wheel setuptools
|
||||||
pip install --upgrade pip wheel setuptools
|
|
||||||
|
|
||||||
# ── Core dependencies ──────────────────────────────
|
"$WORKSPACE/venv/bin/python3" -m pip install -U \
|
||||||
pip install -U \
|
|
||||||
atproto \
|
atproto \
|
||||||
playwright \
|
playwright \
|
||||||
playwright-stealth \
|
playwright-stealth \
|
||||||
@@ -50,44 +43,19 @@ pipeline {
|
|||||||
beautifulsoup4 \
|
beautifulsoup4 \
|
||||||
charset-normalizer \
|
charset-normalizer \
|
||||||
Pillow \
|
Pillow \
|
||||||
grapheme
|
grapheme \
|
||||||
|
yt-dlp \
|
||||||
|
curl-cffi
|
||||||
|
|
||||||
# ── yt-dlp: always upgrade to latest ──────────────
|
# Sanity checks
|
||||||
# TikTok extractor breaks frequently — latest is required
|
"$WORKSPACE/venv/bin/python3" -c "import atproto; print('atproto OK')"
|
||||||
pip install --upgrade yt-dlp
|
"$WORKSPACE/venv/bin/python3" -c "import playwright; print('playwright OK')"
|
||||||
pip show yt-dlp | grep -E "^(Name|Version)"
|
"$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) ─────
|
# Playwright browser binaries
|
||||||
# Without this yt-dlp cannot bypass TikTok bot detection
|
PLAYWRIGHT_BROWSERS_PATH=/var/jenkins_home/.playwright-browsers \
|
||||||
pip install --upgrade curl-cffi
|
"$WORKSPACE/venv/bin/python3" -m playwright install chromium
|
||||||
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
|
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user