Skip to content

Commit

Permalink
Revert use of proxy (#70)
Browse files Browse the repository at this point in the history
* Use SOCKS5 proxy

* Use SOCKS5 proxy -- missed one spot!

* Revert use of SOCKS5 proxy
  • Loading branch information
elliottback authored Dec 30, 2023
1 parent 3553af8 commit 743a59f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/sync-from-reddit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ 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
7 changes: 3 additions & 4 deletions download-wiki.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@

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

USER_AGENT='japanfinance/sync/1.0'
USER_AGENT='wikidownload/1.0'
DOWNLOAD_DIR="download"
DOCS_DIR="docs"
NONDOCS_DIR="archive"
SUBREDDIT="JapanFinance"
PROXY_HOST="proxy-nl.privateinternetaccess.com"

while read -r line; do
# Reddit's anonymous access rate limit is 10 requests per minute
Expand All @@ -27,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 -x socks5://$PROXY_USER:$PROXY_PASSWORD@$PROXY_HOST -sfL -o "$SOURCE_PAGE_JSON" -w '%{http_code}' --user-agent "$USER_AGENT" "https://www.reddit.com/r/$SUBREDDIT/wiki/$PAGE.json")
HTTP_CODE=$(curl -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 All @@ -49,6 +48,6 @@ while read -r line; do
git --no-pager diff
fi

done < <(curl -x socks5://$PROXY_USER:$PROXY_PASSWORD@$PROXY_HOST -SsfL --user-agent "$USER_AGENT" "https://www.reddit.com/r/$SUBREDDIT/wiki/pages.json" | jq -r '.data | .[]')
done < <(curl -SsfL --user-agent "$USER_AGENT" "https://www.reddit.com/r/$SUBREDDIT/wiki/pages.json" | jq -r '.data | .[]')

rm -rf "./$DOWNLOAD_DIR"

0 comments on commit 743a59f

Please sign in to comment.