Skip to content

Commit

Permalink
redditlist.com has changed frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobiasd committed May 16, 2015
1 parent 535ef4e commit 52d19b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions get_subreddits/download.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
rm -r sfw
mkdir sfw
for i in $(seq 1 169); do
wget -O ./sfw/$i.txt http://redditlist.com/page-$i
for i in $(seq 1 34); do
wget -O ./sfw/$i.txt http://redditlist.com/?page=$i
done

rm -r nsfw
mkdir nsfw
for i in $(seq 1 29); do
wget -O ./nsfw/$i.txt http://redditlist.com/nsfw/page-$i
for i in $(seq 1 7); do
wget -O ./nsfw/$i.txt http://redditlist.com/nsfw?page=$i
done
8 changes: 5 additions & 3 deletions get_subreddits/parse.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
function parse {
grep -r $1 -e '.*' | grep -e "reddit.com\/r\/" | grep -v "%" | perl -pe 's/.*reddit.com.r.[^\/]*\/"\>([^\<]*).............([0-9]*).*/ , "\1,\2"/g' > temp_list.txt
grep -r $1 -e '.*' | grep -B 2 listing-stat | perl -pe "s/\n/newline/g" | perl -pe "s/reddit.com.r./\n/g" | perl -pe "s/(.*). target.*listing-stat..(.*)..span.*/\1;\2/g" | perl -pe "s/,//g" | perl -pe "s/;/,/g" | grep -v ".txt:" | perl -pe 's/^(.*)/ , "\1"/g' > temp_list.txt

echo module $2 where > $2.elm.temp
echo "$1Raw : List String" >> $2.elm.temp
echo $1Raw = [ >> $2.elm.temp
cat temp_list.txt | sort | uniq >> $2.elm.temp
echo -n " ]" >> $2.elm.temp
cat $2.elm.temp | perl -0pe "s/\[\n ,/\[\n /g" | perl -pe "s/\0//g" > $2.elm
cat $2.elm.temp > $2.elm
rm $2.elm.temp
rm temp_list.txt
}

parse sfw Sfw
parse nsfw Nsfw
parse nsfw Nsfw

echo "please manually remove comma in line 4"

0 comments on commit 52d19b5

Please sign in to comment.