r/pushshift • u/s_i_m_s • Dec 24 '22
PSA PMAW has been updated to handle the API changes.
Keep in mind the API still has various known issues, these aren't problems with PMAW.
Notably but not limited to;
Submissions earlier than November 3rd still have not been loaded so any searches for submissions earlier than that will fail.
Searching by author will often return unwanted results EG: a search for spez will also return results for I-Am-Spez.
Negation is not working in the author or subreddit fields.
API is not yet stable and will often time out.
For more info on the current known issues with the pushshift API check here
PMAW
https://github.com/mattpodolak/pmaw
https://pypi.org/project/pmaw/
Also tagging /u/potato-sword
8
u/Security_Chief_Odo Dec 24 '22
Thanks for your work on this and trying to incorporate the known changes.
1
u/rogerspublic Dec 26 '22
Thank you. I made an attempt after seeing this announcement, and I'm not clear for the documentation what I am missing. Previously I had used psaw, which is getting a 404 error. With this PSA I tried pmaw and got "ModuleNotFoundError: No module named 'pmaw'". Same message with praw.
#import modules and display options
import os
import datetime as dt
import pandas as pd
from openpyxl import Workbook
from pmaw import PushshiftAPI
#from praw import PushshiftAPI
#from psaw import PushshiftAPI
import warnings
# set times
daterange = '202201201-20221215'
start_epoch=int(dt.datetime(2022, 12, 1).timestamp())
end_epoch=int(dt.datetime(2022, 12, 16).timestamp())
# definition
api = PushshiftAPI()
warnings.filterwarnings("ignore")
. . .
1
u/rogerspublic Jan 04 '23
I"m getting unusual results testing using r/foreveralone. The program below is yielding dates of only Dec 30, 2022, Dec 31, 2022, and Jan 1 2023. I'm getting the same dates whether I am converting created_utc in Python, as is below, or excluding the conversion line below and doing the conversion in Stata, where I do most of my processing and analysis. (I actually prefer to convert in Stata because then I can use to_excel, which works better than to_csv when working with Stata.)
What's odder is that the total combination of submissions and comments is 15,562 for the December pull, which compares favorably to 13,290 in November when every day is accounted for. (I didn't show the comment lines--just a repeat of submission lines.)
Not sure exactly what issue I hit here, but I assume it's tied to the transition.
#import modules and display options
import os
import datetime as dt
import pandas as pd
from openpyxl import Workbook
from pmaw import PushshiftAPI
#from praw import PushshiftAPI
#from psaw import PushshiftAPI
import warnings
# set times
daterange = '202201201-20221231'
start_epoch=int(dt.datetime(2022, 12, 1).timestamp())
end_epoch=int(dt.datetime(2023, 1, 1).timestamp())
print("Starting r/foreveralone")
##### foreveralone #####
# submissions
subreddit = "foreveralone"
print("Now working on r/",subreddit," submissions")
api_request_generator = api.search_submissions(subreddit='foreveralone', after = start_epoch, before=end_epoch)
foreveralone_submissions = pd.DataFrame([submissions for submissions in api_request_generator])
foreveralone_submissions['datetime'] = pd.to_datetime(foreveralone_submissions['created_utc'], utc=True, unit='s')
outputfilesub = subreddit + "_submissions_" + daterange + ".csv"
foreveralone_submissions.to_csv(outputfilesub)
1
u/metaphor_r Jan 10 '23
Thank you, I am changing everything from PSAW to PMAW right now.
I need to search comments by submission IDs. It says right now that the submission comment id search might not work due to the switchover. Can this be solved or won't this be availabe at all?
1
u/[deleted] Jan 11 '23
Is there an ETA for earlier submissions loading or workarounds?
3
u/potato-sword Dec 24 '22
Thanks for posting this!
1
u/sc00p Dec 30 '22 edited Dec 31 '22
Hey! I'm trying to get PMAW to work, but I seem to be doing something wrong. I'm wondering if you can help me out.
I use this script to get some data:
I get this as output in 'gen':
1
u/LudWigVonPoopen Jan 06 '23
Whenever I search for submissions with pmaw I'm always getting the message INFO:pmaw.PushshiftAPIBase:0 result(s) available in Pushshift for some reason. Here is a copy of one of the requests I tried making:
Anyone know if this is something on my end or just issues with PushShift/PMAW at the moment?