mirror of
https://github.com/bellingcat/facebook-downloader.git
synced 2026-06-08 03:28:31 +03:00
Added setup scripts.
This commit is contained in:
27
install.ps1
Normal file
27
install.ps1
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# Define URL for GeckoDriver
|
||||||
|
$geckoURL = "https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-win64.zip"
|
||||||
|
|
||||||
|
# Define target directories for installation
|
||||||
|
$geckoDir = "$env:USERPROFILE\facebook-downloader\GeckoDriver"
|
||||||
|
|
||||||
|
# Function to download a file
|
||||||
|
function DownloadFile([string]$url, [string]$path) {
|
||||||
|
Invoke-WebRequest -Uri $url -OutFile $path
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if GeckoDriver directory exists, if not create and download
|
||||||
|
if (-Not (Test-Path $geckoDir)) {
|
||||||
|
New-Item -Path $geckoDir -ItemType Directory
|
||||||
|
Write-Host "Downloading GeckoDriver..."
|
||||||
|
DownloadFile $geckoURL "$geckoDir\geckodriver.zip"
|
||||||
|
|
||||||
|
# Unzipping the GeckoDriver
|
||||||
|
Expand-Archive -Path "$geckoDir\geckodriver.zip" -DestinationPath $geckoDir
|
||||||
|
Remove-Item "$geckoDir\geckodriver.zip"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add the geckodriver directory to PATH
|
||||||
|
[Environment]::SetEnvironmentVariable("PATH", [Environment]::GetEnvironmentVariable("PATH", [EnvironmentVariableTarget]::User) + ";$geckoDir", [EnvironmentVariableTarget]::User)
|
||||||
|
|
||||||
|
pip install .
|
||||||
|
Write-Host "Setup complete."
|
||||||
9
install.sh
Normal file
9
install.sh
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Download geckodriver .tar.gz file and pipe it to 'tar' to extract the geckodriver binary directly into /usr/bin.
|
||||||
|
curl -L https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux64.tar.gz | \
|
||||||
|
tar xz -C /usr/bin
|
||||||
|
|
||||||
|
# Install Python packages defined in the current directory's setup.py/pyproject.toml file. (pyproject.toml in this case)
|
||||||
|
pip3 install .
|
||||||
|
echo "Setup complete."
|
||||||
26
uninstall.ps1
Normal file
26
uninstall.ps1
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Define target directory for removal
|
||||||
|
$geckoDir = "$env:USERPROFILE\facebook-downloader\GeckoDriver"
|
||||||
|
|
||||||
|
# Function to remove directory
|
||||||
|
function RemoveDir([string]$dirPath) {
|
||||||
|
if (Test-Path $dirPath) {
|
||||||
|
Remove-Item -Path $dirPath -Recurse -Force
|
||||||
|
Write-Host "Removed directory: $dirPath"
|
||||||
|
} else {
|
||||||
|
Write-Host "Directory $dirPath does not exist."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove GeckoDriver directory
|
||||||
|
RemoveDir $geckoDir
|
||||||
|
|
||||||
|
# Remove the geckodriver directory from PATH
|
||||||
|
$pathEnv = [Environment]::GetEnvironmentVariable("PATH", [EnvironmentVariableTarget]::User)
|
||||||
|
$newPath = ($pathEnv -split ";" | Where-Object { $_ -ne $geckoDir }) -join ";"
|
||||||
|
[Environment]::SetEnvironmentVariable("PATH", $newPath, [EnvironmentVariableTarget]::User)
|
||||||
|
Write-Host "Removed GeckoDriver directory from PATH."
|
||||||
|
|
||||||
|
# Uninstall facebook-downloader Python package
|
||||||
|
pip uninstall facebook-downloader -y
|
||||||
|
|
||||||
|
Write-Host "Cleanup complete."
|
||||||
8
uninstall.sh
Normal file
8
uninstall.sh
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Remove the geckodriver binary from /usr/bin
|
||||||
|
sudo rm /usr/bin/geckodriver -v
|
||||||
|
|
||||||
|
# Uninstall tor2tor
|
||||||
|
pip3 uninstall facebook-downloader -y -v
|
||||||
|
echo "Cleanup complete."
|
||||||
Reference in New Issue
Block a user