* tools file name change to utils

* Seperate downloaders (#94)

* Seperated the downloaders

* Remove redundant code

* Changed file names

* refactor

* Redgifs (#95)

* Init commit

* Init commit

* GifDeliveryNetwork (#96)

* Initial commit

* Gfycat forwarding to GDN bug fixed
This commit is contained in:
Ali Parlakçı
2020-05-28 21:42:11 +03:00
committed by GitHub
parent c5a2eed80f
commit 148e20d1d6
14 changed files with 733 additions and 550 deletions

View File

@@ -14,11 +14,17 @@ import webbrowser
from io import StringIO
from pathlib import Path, PurePath
from src.downloader import Direct, Erome, Gfycat, Imgur, Self
from src.downloaders.Direct import Direct
from src.downloaders.Erome import Erome
from src.downloaders.Gfycat import Gfycat
from src.downloaders.Imgur import Imgur
from src.downloaders.redgifs import Redgifs
from src.downloaders.selfPost import SelfPost
from src.downloaders.gifDeliveryNetwork import GifDeliveryNetwork
from src.errors import *
from src.parser import LinkDesigner
from src.searcher import getPosts
from src.tools import (GLOBAL, createLogFile, jsonFile, nameCorrector,
from src.utils import (GLOBAL, createLogFile, jsonFile, nameCorrector,
printToFile)
__author__ = "Ali Parlakci"
@@ -496,7 +502,8 @@ def downloadPost(SUBMISSION):
global lastRequestTime
downloaders = {
"imgur":Imgur,"gfycat":Gfycat,"erome":Erome,"direct":Direct,"self":Self
"imgur":Imgur,"gfycat":Gfycat,"erome":Erome,"direct":Direct,"self":SelfPost,
"redgifs":Redgifs, "gifdeliverynetwork": GifDeliveryNetwork
}
print()
@@ -532,7 +539,7 @@ def downloadPost(SUBMISSION):
if not (credit['UserRemaining'] == 0 or \
credit['ClientRemaining'] == 0):
"""This block of code is needed
"""This block of code is needed for API workaround
"""
while int(time.time() - lastRequestTime) <= 2:
pass
@@ -568,7 +575,7 @@ def download(submissions):
FAILED_FILE = createLogFile("FAILED")
for i in range(subsLenght):
print(f"\n({i+1}/{subsLenght}) r/{submissions[i]['postSubreddit']}",
print(f"\n({i+1}/{subsLenght}) {submissions[i]['postId']} r/{submissions[i]['postSubreddit']}",
end="")
print(f" {submissions[i]['postType'].upper()}",end="",noPrint=True)