Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Commit

Permalink
Update to new base URL, fix #24
Browse files Browse the repository at this point in the history
deviant art moved from "xx.deviantart.com" to "deviantart.com/xx"
  • Loading branch information
voyageur committed Jul 18, 2018
1 parent a20ceeb commit 0934bb2
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions dagr/dagr.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def handle_download_error(self, link, link_error):

def deviant_get(self, mode):
print("Ripping " + self.deviant + "'s " + mode + "...")
pat = r"https://[a-zA-Z0-9_-]*\.deviantart\.com/art/[a-zA-Z0-9_-]*"
pat = r"https://www\.deviantart\.com/[a-zA-Z0-9_-]*/art/[a-zA-Z0-9_-]*"
mode_arg = '_'
if mode.find(':') != -1:
mode = mode.split(':', 1)
Expand All @@ -210,7 +210,7 @@ def deviant_get(self, mode):
pages = []
for i in range(0, int(Dagr.MAX_DEVIATIONS / 24), 24):
html = ""
url = "https://" + self.deviant.lower() + ".deviantart.com/"
url = "https://www.deviantart.com/" + self.deviant.lower() + "/"

if mode == "favs":
url += "favourites/?catpath=/&offset=" + str(i)
Expand Down Expand Up @@ -321,8 +321,8 @@ def group_get(self, mode):

inside_folder = False
# are we inside a gallery folder?
html = self.get('https://' + self.deviant +
'.deviantart.com/' + strmode2 + '/')
html = self.get('https://www.deviantart.com/' +
self.deviant + '/' + strmode2 + '/')
if re.search(strmode2 + r"/\?set=.+&offset=", html,
re.IGNORECASE | re.S):
inside_folder = True
Expand All @@ -334,7 +334,8 @@ def group_get(self, mode):

i = 0
while not inside_folder:
html = self.get('https://' + self.deviant + '.deviantart.com/' +
html = self.get('https://www.deviantart.com' +
self.deviant + '/' +
strmode2 + '/?offset=' + str(i))
k = re.findall(strmode + ":" + self.deviant +
r"/\d+\"\ +label=\"[^\"]*\"", html, re.IGNORECASE)
Expand Down Expand Up @@ -365,17 +366,19 @@ def group_get(self, mode):
if self.reverse:
folders.reverse()

pat = (r"https:\\/\\/[a-zA-Z0-9_-]*\.deviantart\.com"
pat = (r"https:\\/\\/www\.\.deviantart\.com"
r"\\/[a-zA-Z0-9_-]*\\/"
r"\\/art\\/[a-zA-Z0-9_-]*")
pages = []
for folder in folders:
folderid = re.search("[0-9]+", folder, re.IGNORECASE).group(0)
label = re.search("label=\"([^\"]*)", folder,
re.IGNORECASE).group(1)
for i in range(0, int(Dagr.MAX_DEVIATIONS / 24), 24):
html = self.get("https://" + self.deviant.lower() +
".deviantart.com/" + strmode2 + "/?set=" +
folderid + "&offset=" + str(i - 24))
html = self.get('https://www.deviantart.com/' +
self.deviant.lower() + '/' +
strmode2 + '/?set=' +
folderid + '&offset=' + str(i - 24))
prelim = re.findall(pat, html, re.IGNORECASE)
if not prelim:
break
Expand Down Expand Up @@ -558,8 +561,8 @@ def main():
group = False
try:
deviant = re.search(r'<title>.[A-Za-z0-9-]*',
ripper.get("https://" + deviant +
".deviantart.com"),
ripper.get('https://www.deviantart.com/' +
deviant + '/'),
re.IGNORECASE).group(0)[7:]
if re.match("#", deviant):
group = True
Expand Down

0 comments on commit 0934bb2

Please sign in to comment.