Version 20230727.02. Only allow GNU Wget 1.21.3-at.20230623.01. Use Wget-AT option --reject-reserved-subnets. Remove old Wget files. Update README to latest.

pull/18/head
arkiver 10 months ago
parent 288c9b731c
commit 6e73452ec5

@ -1,226 +1,53 @@
reddit-grab
=============
# reddit-grab
More information about the archiving project can be found on the ArchiveTeam wiki: [Reddit](http://archiveteam.org/index.php?title=Reddit)
More information about the archiving project can be found on the ArchiveTeam wiki: [Reddit](https://wiki.archiveteam.org/index.php?title=Reddit)
Setup instructions
=========================
## Setup instructions
Be sure to replace `YOURNICKHERE` with the nickname that you want to be shown as, on the tracker. You don't need to register it, just pick a nickname you like.
### General instructions
In most of the below cases, there will be a web interface running at http://localhost:8001/. If you don't know or care what this is, you can just ignore it—otherwise, it gives you a fancy view of what's going on.
Data integrity is very important in Archive Team projects. Please note the following important rules:
**If anything goes wrong while running the commands below, please scroll down to the bottom of this page. There's troubleshooting information there.**
* [Do not use proxies or VPNs](https://wiki.archiveteam.org/index.php/ArchiveTeam_Warrior#Can_I_use_whatever_internet_access_for_the_Warrior?).
* Run the project using the either the Warrior or the project-specific Docker container as listed below. [Do not modify project code](https://wiki.archiveteam.org/index.php/ArchiveTeam_Warrior#I'd_like_to_help_write_code_or_I_want_to_tweak_the_scripts_to_run_to_my_liking._Where_can_I_find_more_info?_Where_is_the_source_code_and_repository?). Compiling the project dependencies yourself is no longer supported.
* You can share your tracker nickname(s) across machine(s) you personally operate, but not with machines operated by other users. Nickname sharing makes it harder to inspect data if a problem arises.
* [Use clean internet connections](https://wiki.archiveteam.org/index.php/ArchiveTeam_Warrior#Can_I_use_whatever_internet_access_for_the_Warrior?).
* Only x64-based machines are supported. [ARM (used on Raspberry Pi and Apple Silicon Macs) is not currently supported](https://wiki.archiveteam.org/index.php/ArchiveTeam_Warrior#Can_I_run_the_Warrior_on_ARM_or_some_other_unusual_architecture?).
* See the [Archive Team Wiki](https://wiki.archiveteam.org/index.php/ArchiveTeam_Warrior#Warrior_FAQ) for additional information.
Running with a warrior
-------------------------
We strongly encourage you to join the IRC channel associated with this project in order to be informed about project updates and other important announcements, as well as to be reachable in the event of an issue. The Archive Team Wiki has [more information about IRC](https://wiki.archiveteam.org/index.php/Archiveteam:IRC). We can be found at hackint IRC [#shreddit](https://webirc.hackint.org/#irc://irc.hackint.org/#shreddit).
Follow the [instructions on the ArchiveTeam wiki](http://archiveteam.org/index.php?title=Warrior) for installing the Warrior, and select the "Reddit" project in the Warrior interface.
**If you have any questions or issues during setup, please review the wiki pages or contact us on IRC for troubleshooting information.**
Running with Docker
-------------------------
### Running the project
The recommended way to run these projects is with Docker. The instructions below are a short overview. For more information and detailed explanations of the commands, follow the follow the [Docker instructions on the Archive Team wiki](https://wiki.archiveteam.org/index.php/Running_Archive_Team_Projects_with_Docker).
#### Archive Team Warrior (recommended for most users)
It is advised to use watchtower to automatically update the project. This requires watchtower:
This and other archiving projects can easily be run using the [Archive Team Warrior](https://wiki.archiveteam.org/index.php/ArchiveTeam_Warrior) virtual machine. Follow the [instructions on the Archive Team wiki](https://wiki.archiveteam.org/index.php/ArchiveTeam_Warrior) for installing the Warrior, and from the web interface running at `http://localhost:8001/`, enter the nickname that you want to be shown as on the tracker. There is no registration, just pick a nickname you like. Then, select the `Reddit` project in the Warrior interface.
docker run --name watchtower --restart=unless-stopped -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --label-enable --cleanup --interval 3600
#### Project-specific Docker container (for more advanced users)
after which the project can be run:
Alternatively, more advanced users can also run projects using Docker. While users of the Warrior can switch between projects using a web interface, Docker containers are specific to each project. However, while the Warrior supports a maximum of 6 concurrent items, a Docker container supports a maximum of 20 concurrent items. The instructions below are a short overview. For more information and detailed explanations of the commands, follow the follow the [Docker instructions on the Archive Team wiki](https://wiki.archiveteam.org/index.php/Running_Archive_Team_Projects_with_Docker).
docker run --name archiveteam --label=com.centurylinklabs.watchtower.enable=true --restart=unless-stopped atdr.meo.ws/archiveteam/reddit-grab --concurrent 1 YOURNICKHERE
It is advised to use [Watchtower](https://github.com/containrrr/watchtower) to automatically update the project container:
Running without a warrior or Docker
-------------------------
To run this outside the warrior, clone this repository, cd into its directory and run:
docker run -d --name watchtower --restart=unless-stopped -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --label-enable --cleanup --interval 3600
python3 -m pip install setuptools wheel
python3 -m pip install --upgrade seesaw zstandard requests
./get-wget-lua.sh
after which the project container can be run:
then start downloading with:
docker run -d --name archiveteam --label=com.centurylinklabs.watchtower.enable=true --restart=unless-stopped atdr.meo.ws/archiveteam/reddit-grab --concurrent 1 YOURNICKHERE
run-pipeline3 pipeline.py --concurrent 2 YOURNICKHERE
Be sure to replace `YOURNICKHERE` with the nickname that you want to be shown as on the tracker. There is no registration, just pick a nickname you like.
For more options, run:
### Supporting Archive Team
run-pipeline3 --help
If you don't have root access and/or your version of pip is very old, you can replace "pip install --upgrade seesaw" with:
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py ; python3 get-pip.py --user ; ~/.local/bin/pip3 install --upgrade --user seesaw
so that pip and seesaw are installed in your home, then run
~/.local/bin/run-pipeline3 pipeline.py --concurrent 2 YOURNICKHERE
Running multiple instances on different IPs
-------------------------------------------
This feature requires seesaw version 0.0.16 or greater. Use `pip install --upgrade seesaw` to upgrade.
Use the `--context-value` argument to pass in `bind_address=123.4.5.6` (replace the IP address with your own).
Example of running 2 threads, no web interface, and Wget binding of IP address:
run-pipeline3 pipeline.py --concurrent 2 YOURNICKHERE --disable-web-server --context-value bind_address=123.4.5.6
Distribution-specific setup
-------------------------
### For Debian/Ubuntu:
Package `libzstd-dev` version 1.4.4 is required which is currently available from `buster-backports`.
adduser --system --group --shell /bin/bash archiveteam
echo deb http://deb.debian.org/debian buster-backports main contrib > /etc/apt/sources.list.d/backports.list
apt-get update \
&& apt-get install -y git-core libgnutls-dev lua5.1 liblua5.1-0 liblua5.1-0-dev screen bzip2 zlib1g-dev flex autoconf autopoint texinfo gperf lua-socket lua-filesystem lua-sec lua-zip rsync automake pkg-config python3-dev python3-pip build-essential poppler-utils \
&& apt-get -t buster-backports install zstd libzstd-dev libzstd1
python3 -m pip install setuptools wheel
python3 -m pip install --upgrade seesaw zstandard requests
su -c "cd /home/archiveteam; git clone https://github.com/ArchiveTeam/reddit-grab.git; cd reddit-grab; ./get-wget-lua.sh" archiveteam
screen su -c "cd /home/archiveteam/reddit-grab/; run-pipeline3 pipeline.py --concurrent 2 --address '127.0.0.1' YOURNICKHERE" archiveteam
[... ctrl+A D to detach ...]
In __Debian Jessie, Ubuntu 18.04 Bionic and above__, the `libgnutls-dev` package was renamed to `libgnutls28-dev`. So, you need to do the following instead:
adduser --system --group --shell /bin/bash archiveteam
echo deb http://deb.debian.org/debian buster-backports main contrib > /etc/apt/sources.list.d/backports.list
apt-get update \
&& apt-get install -y git-core libgnutls28-dev lua5.1 liblua5.1-0 liblua5.1-0-dev screen bzip2 zlib1g-dev flex autoconf autopoint texinfo gperf lua-socket lua-filesystem lua-sec lua-zip rsync automake pkg-config python3-dev python3-pip build-essential poppler-utils \
&& apt-get -t buster-backports install zstd libzstd-dev libzstd1
[... pretty much the same as above ...]
Wget-lua is also available on [ArchiveTeam's PPA](https://launchpad.net/~archiveteam/+archive/wget-lua) for Ubuntu.
### For CentOS:
THESE INSTRUCTIONS ARE OUTDATED
Ensure that you have the CentOS equivalent of bzip2 installed as well. You will need the EPEL repository to be enabled.
yum -y groupinstall "Development Tools"
yum -y install gnutls-devel lua-devel python-pip zlib-devel zstd libzstd-devel git-core gperf lua-socket luarocks texinfo git rsync gettext-devel
pip install --upgrade seesaw
[... pretty much the same as above ...]
Tested with EL7 repositories.
### For Fedora:
The same as CentOS but with "dnf" instead of "yum". Did not successfully test compiling, so far.
### For openSUSE:
THESE INSTRUCTIONS ARE OUTDATES
zypper install liblua5_1 lua51 lua51-devel screen python-pip libgnutls-devel bzip2 python-devel gcc make
pip install --upgrade seesaw
[... pretty much the same as above ...]
### For OS X:
THESE INSTRUCTIONS ARE OUTDATED
You need Homebrew. Ensure that you have the OS X equivalent of bzip2 installed as well.
brew install python lua gnutls
pip install --upgrade seesaw
[... pretty much the same as above ...]
**There is a known issue with some packaged versions of rsync. If you get errors during the upload stage, reddit-grab will not work with your rsync version.**
This supposedly fixes it:
alias rsync=/usr/local/bin/rsync
### For Arch Linux:
Ensure that you have the Arch equivalent of bzip2 installed as well.
1. Make sure you have `python2-pip` installed.
2. Install [the wget-lua package from the AUR](https://aur.archlinux.org/packages/wget-lua/).
3. Run `pip2 install --upgrade seesaw`.
4. Modify the run-pipeline script in seesaw to point at `#!/usr/bin/python2` instead of `#!/usr/bin/python`.
5. `useradd --system --group users --shell /bin/bash --create-home archiveteam`
6. `screen su -c "cd /home/archiveteam/reddit-grab/; run-pipeline pipeline.py --concurrent 2 --address '127.0.0.1' YOURNICKHERE" archiveteam`
### For Alpine Linux:
Install the dependencies for Zstd and Wget-AT:
apk update && apk add lua5.1 lua5.1-socket lua5.1-sec python3 py3-pip git gcc libc-dev \
lua5.1-dev lua5.1-filesystem zlib-dev gnutls-dev automake autoconf make bash \
bzip2 rsync flex gettext gettext-dev xz gperf texinfo wget coreutils ca-certificates \
poppler-utils
Version 1.4.4 of Zstd is required, so this needs to be built from source for compatibility with arguments provided from other Alpine builds:
# Source: https://git.alpinelinux.org/aports/tree/main/zstd/APKBUILD?h=3.15-stable
git clone https://github.com/facebook/zstd.git --depth 1 --branch v1.4.4
cd zstd && export CFLAGS="-O2" && \
make -C lib HAVE_PTHREAD=1 HAVE_ZLIB=0 HAVE_LZMA=0 HAVE_LZ4=0 lib-mt && \
make -C programs HAVE_PTHREAD=1 HAVE_ZLIB=0 HAVE_LZMA=0 HAVE_LZ4=0 && \
make -C contrib/pzstd && \
make PREFIX="/usr" install && \
cd ..
Close the repo and build Wget-AT:
git clone https://github.com/ArchiveTeam/reddit-grab
cd reddit-grab; ./get-wget-lua.sh
Run the project with
# uncomments the next line if you want to use a virtualenv (sh/bash example)
#python3 -m venv --prompt at .venv && source .venv/bin/activate
pip install --upgrade pip setuptools wheel
pip install --upgrade seesaw zstandard requests
run-pipeline3 pipeline.py --concurrent 2 --address '127.0.0.1' YOURNICKHERE
### For FreeBSD:
Honestly, I have no idea. `./get-wget-lua.sh` supposedly doesn't work due to differences in the `tar` that ships with FreeBSD. Another problem is the apparent absence of Lua 5.1 development headers. If you figure this out, please do let us know on IRC (irc.hackint.org #archiveteam).
Troubleshooting
=========================
Broken? These are some of the possible solutions:
### wget-lua was not successfully built
If you get errors about `wget.pod` or something similar, the documentation failed to compile - wget-lua, however, compiled fine. Try this:
cd get-wget-lua.tmp
mv src/wget ../wget-lua
cd ..
The `get-wget-lua.tmp` name may be inaccurate. If you have a folder with a similar but different name, use that instead and please let us know on IRC what folder name you had!
Optionally, if you know what you're doing, you may want to use wgetpod.patch.
### Problem with gnutls or openssl during get-wget-lua
Please ensure that gnutls-dev(el) and openssl-dev(el) are installed.
### ImportError: No module named seesaw
If you're sure that you followed the steps to install `seesaw`, permissions on your module directory may be set incorrectly. Try the following:
chmod o+rX -R /usr/local/lib/python2.7/dist-packages
### run-pipeline: command not found
Install `seesaw` using `pip2` instead of `pip`.
pip2 install seesaw
Behind the scenes Archive Team has infrastructure to run the projects and process the data with. If you would like to help out with the costs of our infrastructure, a donation on our [Open Collective](https://opencollective.com/archiveteam) would be very welcome.
### Issues in the code
If you notice a bug and want to file a bug report, please use the GitHub issues tracker.
Are you a developer? Help write code for us! Look at our [developer documentation](http://archiveteam.org/index.php?title=Dev) for details.
Are you a developer? Help write code for us! Look at our [developer documentation](https://wiki.archiveteam.org/index.php?title=Dev) for details.
### Other problems

@ -1,57 +0,0 @@
#!/usr/bin/env bash
#
# This script clones and compiles wget-lua.
#
# first, try to detect gnutls or openssl
CONFIGURE_SSL_OPT=""
if builtin type -p pkg-config &>/dev/null
then
if pkg-config gnutls
then
echo "Compiling wget with GnuTLS."
CONFIGURE_SSL_OPT="--with-ssl=gnutls"
elif pkg-config openssl
then
echo "Compiling wget with OpenSSL."
CONFIGURE_SSL_OPT="--with-ssl=openssl"
fi
fi
if ! zstd --version | grep -q 1.4.4
then
echo "Need version 1.4.4 of libzstd-dev and zstd"
exit 1
fi
rm -rf get-wget-lua.tmp/
mkdir -p get-wget-lua.tmp
cd get-wget-lua.tmp
git clone https://github.com/archiveteam/wget-lua.git
cd wget-lua
git checkout v1.20.3-at
#echo -n 1.20.3-at-lua | tee ./.version ./.tarball-version > /dev/null
if ./bootstrap && ./configure $CONFIGURE_SSL_OPT --disable-nls && make && src/wget -V | grep -q lua
then
cp src/wget ../../wget-at
cd ../../
echo
echo
echo "###################################################################"
echo
echo "wget-lua successfully built."
echo
./wget-at --help | grep -iE "gnu|warc|lua"
rm -rf get-wget-lua.tmp
exit 0
else
echo
echo "wget-lua not successfully built."
echo
exit 1
fi

@ -42,7 +42,7 @@ if StrictVersion(seesaw.__version__) < StrictVersion('0.8.5'):
WGET_AT = find_executable(
'Wget+AT',
[
'GNU Wget 1.21.3-at.20230605.01'
'GNU Wget 1.21.3-at.20230623.01'
],
[
'./wget-at',
@ -59,7 +59,7 @@ if not WGET_AT:
#
# Update this each time you make a non-cosmetic change.
# It will be added to the WARC files and reported to the tracker.
VERSION = '20230727.01'
VERSION = '20230727.02'
TRACKER_ID = 'reddit'
TRACKER_HOST = 'legacy-api.arpa.li'
MULTI_ITEM_SIZE = 40
@ -241,6 +241,7 @@ class WgetArgs(object):
'--hosts-file', '/dev/null',
'--resolvconf-file', '/dev/null',
'--dns-servers', '9.9.9.10,149.112.112.10,2620:fe::10,2620:fe::fe:10',
'--reject-reserved-subnets',
'--load-cookies', 'cookies.txt',
'--content-on-error',
'--no-http-keep-alive',

Binary file not shown.
Loading…
Cancel
Save