Add file downloader to filler
This commit is contained in:
parent
0856063459
commit
45890fd103
1 changed files with 11 additions and 1 deletions
12
filler.py
12
filler.py
|
@ -1,6 +1,16 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse, dbtools, dbtools.fillerfilter, setuptools, time, twitools
|
||||
import argparse, dbtools, dbtools.fillerfilter, requests, setuptools, time, twitools
|
||||
|
||||
def downloadMedia(url, tid, mid):
|
||||
remote = requests.get(url, stream=True)
|
||||
filename = "media/%i_%i.%s" % (tid, mid, url.split(".")[-1])
|
||||
|
||||
with open(filename, 'wb') as outfile:
|
||||
for chunk in remote.iter_content(chunk_size=1024):
|
||||
if chunk:
|
||||
outfile.write(chunk)
|
||||
outfile.flush()
|
||||
|
||||
def getTweets(db=dbtools.dbHelper(), user=twitools.twObject().whoami(), two=twitools.twObject()):
|
||||
query = "from:" + user
|
||||
|
|
Loading…
Reference in a new issue