Comments (4)
Tested several times.
If initiate with no before parameter and then use the printed timestamp as the "before" to resume, the first try to resume will NOT load the initial requests. It will show no cached requests loaded and start all over. When you re-run the query again with the before value, it will load the first resume attempt, but as the items remaining start over, the scraping also restarted.
So basically, I cannot find a way to recover interrupted scraping.
from pmaw.
Hi @YukunYangNPF I investigated this issue, and there appears to be a logging issue when the cache is loaded. I found when I ran your example code that the cache was being loaded, but not being reported as loaded.
I have added a static method in v2.1.0
that will allow you to load responses directly from the cache to work with, as well as I have modified the logging so that its clear when the cache is loaded.
from pmaw.
@mattpodolak
def submissions(subreddit,after=[2020,1,1],before=[2021,1,1],limit=None,num_workers=20,file_checkpoint=8):
after = int(dt.datetime(after[0], after[1], after[2]).timestamp())
before = int(dt.datetime(before[0], before[1], before[2]).timestamp())
api = PushshiftAPI(num_workers=num_workers,file_checkpoint=file_checkpoint)
cache_dir = 'drive/My Drive/scraped data/cache/' + subreddit + '/'
api.search_submissions(subreddit=subreddit, after=after,before=before,safe_exit=True,limit=limit,sort='desc',cache_dir=cache_dir,mem_safe=True)
def func():
try:
submissions('science')
except:
print('\n FUCK ERRORS \n')
func()
func()
Can you tell me how to resolve this.
After few "FUCK ERRORS", it just starts again from the beginning.
(I dump the cache data later using a different code. I just complete collecting the pickle(gzip) files first.)
from pmaw.
Hi @gauravkhadgi thanks for reporting this issue what exception is being thrown when you run this code? Also, can you open a new issue as this doesnt seem related to the parent issue?
from pmaw.
Related Issues (20)
- How to skip a request if taking too long? HOT 5
- ChunkedEncodingError while scraping subreddit submissions HOT 10
- Unable to fetch comments by ID HOT 3
- Fetching comments never completes HOT 2
- Issues with search_comments and search_submission_comment_ids HOT 3
- Cannot pass https_proxy parameter to PushShift function
- Confusion about multithreading HOT 1
- signal only works in main thread HOT 5
- api call seems to return nothing HOT 17
- Returned 0 result HOT 19
- Changed format in parent_id HOT 2
- Comment and submission search snags
- Issue with limit? HOT 7
- always 100 unique ids despite the size of returned comments HOT 2
- Subreddit restriction is not an exact name match and includes subreddits with a superset of that name HOT 3
- Adding flair search
- Sort = "created_utc" didnt sort results properly HOT 1
- Can not get post_ids
- Am I able to ask what is the maximum number of comments can I get from a post
- PullPush - PushShift replacement
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pmaw.