Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 42fd92e

Browse files
committed
Update gitignore and script read tokens from JSON
Converted the .txt file holding the Reddit tokens into a JSON file and changed the script to read from JSON
1 parent 60cf844 commit 42fd92e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

‎Reddit Meme Scraper/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ venv/
22
.idea/
33
*.csv
44
Test/
5-
reddit_tokens.txt
5+
reddit_tokens.json
66
scriptcopy.py
77
*.png
88
*.jpg

‎Reddit Meme Scraper/script.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import wget
44
import pandas as pd
55
import datetime as dt
6+
import json
67
import os
78

89
destination_folder = sg.popup_get_folder('Choose where to download files:\n\n'
@@ -17,20 +18,22 @@
1718

1819
class RedditCred:
1920
def __init__(self):
20-
self.text_file = 'reddit_tokens.txt'
21+
self.text_file = 'reddit_tokens.json'
2122

2223
# Functions made to read the reddit app id and secret from file
2324
def read_id(self):
2425
file = self.text_file
2526
with open(file, 'r') as f:
26-
lines = f.readlines()
27-
return lines[0].strip()
27+
data = json.load(f)
28+
keys = data.keys()
29+
return str(*keys)
2830

2931
def read_secret(self):
3032
file = self.text_file
3133
with open(file, 'r') as f:
32-
lines = f.readlines()
33-
return lines[1].strip()
34+
data = json.load(f)
35+
value = data.values()
36+
return str(*value)
3437

3538

3639
red_cred = RedditCred()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /