Skip to content

Commit

Permalink
Use SOCKS5 proxy (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottback authored Dec 30, 2023
1 parent a6ee942 commit 5571d27
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/sync-from-reddit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
new-commit: ${{ steps.push.outputs.commit }}
permissions:
contents: write
env:
PROXY_USER: ${{ secrets.PROXY_USER }}
PROXY_PASSWORD: ${{ secrets.PROXY_PASSWORD }}
steps:
- uses: actions/checkout@v4

Expand Down
4 changes: 2 additions & 2 deletions download-wiki.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Adapted from https://www.reddit.com/r/DataHoarder/comments/ga2p8y/comment/idpu8cs/

USER_AGENT='wikidownload/1.0'
USER_AGENT='japanfinance/sync/1.0'
DOWNLOAD_DIR="download"
DOCS_DIR="docs"
NONDOCS_DIR="archive"
Expand All @@ -26,7 +26,7 @@ while read -r line; do
# strip file name from end of path when making directories
mkdir -p "${SOURCE_PAGE_JSON%/*}"
mkdir -p "${TARGET_PAGE_MD%/*}"
HTTP_CODE=$(curl -sfL -o "$SOURCE_PAGE_JSON" -w '%{http_code}' --user-agent "$USER_AGENT" "https://www.reddit.com/r/$SUBREDDIT/wiki/$PAGE.json")
HTTP_CODE=$(curl -x socks5://$PROXY_USER:$PROXY_PASSWORD@proxy-nl.privateinternetaccess.com -sfL -o "$SOURCE_PAGE_JSON" -w '%{http_code}' --user-agent "$USER_AGENT" "https://www.reddit.com/r/$SUBREDDIT/wiki/$PAGE.json")

if ! [[ "$HTTP_CODE" =~ ^2 ]]; then
echo "ERROR: server returned HTTP code $HTTP_CODE, skipping: $PAGE"
Expand Down

0 comments on commit 5571d27

Please sign in to comment.